Hi everybody,
I was pretty active with PD for a while, but got kinda side-tracked unfortunatly. Anyways, if somebody could be so kind to help me back in the saddle. I need to round down a float. Right now the value (which is timer actually) is something like 24.4648736 I need it to be 24.5 in this case. I couldnt find an object to do this. But im sure ive missed something, as i know ive done this before.
thanks for the help Anton
AW> I need to round down a float. Right now the value (which is timer actually) AW> is something like 24.4648736 AW> I need it to be 24.5 in this case.
dunno if there's a round external somewhere but you could subtract a float number from its integer equivalent with [int ] then use [moses ] to determine when you should keep the original or increment with 0.1
no time right now to make you the patch, but this should not be too hard using those 2 objects and some operators.
bests
++ aymeric. http://bleu255.com
[int] will round down to integer, that is it cuts of all decimals.
To do rounding of a (positive) float to a decimal place: for instance to 2 decimals behind the komma:
[* 100] | [+ 0.5] ; that is to round properly instead of just cutting the decimals | [int] | [/ 100]
gr Gerard
On Monday 09 February 2004 21:58, Anton Woldhek wrote:
Hi everybody,
I was pretty active with PD for a while, but got kinda side-tracked unfortunatly. Anyways, if somebody could be so kind to help me back in the saddle. I need to round down a float. Right now the value (which is timer actually) is something like 24.4648736 I need it to be 24.5 in this case. I couldnt find an object to do this. But im sure ive missed something, as i know ive done this before.
thanks for the help Anton
PD-list mailing list PD-list@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-list
Hi,
I made an abstraction a while ago which can do this. Unfortunately it is named in german ("runden"). You can also give an argument like runden 4 which would round floats to 99.1234. default is to round to no commas.
find it at
http://www.parasitaere-kapazitaeten.net/Pd/pdpatches/index.htm resp. http://www.parasitaere-kapazitaeten.net/Pd/pdpatches/runden.pd
Marius.
----- Original Message ----- From: "Anton Woldhek" woldhek@xs4all.nl To: PD-list@iem.at Sent: Monday, February 09, 2004 10:58 PM Subject: [PD] [newbie] rounding
Hi everybody,
I was pretty active with PD for a while, but got kinda side-tracked unfortunatly. Anyways, if somebody could be so kind to help me back in the saddle. I need to round down a float. Right now the value (which is timer
actually)
is something like 24.4648736 I need it to be 24.5 in this case. I couldnt find an object to do this.
But
im sure ive missed something, as i know ive done this before.
thanks for the help Anton
PD-list mailing list PD-list@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-list
Thanks Gerard, aymeric. & Marius (and the list ofcourse),
I feel a bit of a D'oH because I couldnt remember the [int] object. The next that I'll ask a question, I promise it will be a better one :)
Cheers Anton