hi,
i've just dropped a knob obj and wondering why the the knob output is float and a slider output is int by default. is there a chance to have the knob output integer or is this a bug ?
Knob and slider behavior
hi,
i've just dropped a knob obj and wondering why the the knob output is float and a slider output is int by default. is there a chance to have the knob output integer or is this a bug ?
I guess its just a matter of different implementations. But hey, it's puredata so you can convert any format into any other format (by the way, I believe pd stores all numbers as 32bit floats anyway, even integers). Use the [int] object to round a float to an integer value (but it will still be a 32bit float).
|] [] |.| ][|-| -- http://soundcloud.com/domxh
yes, maybe a implementation problem. i'll me out with your advice. thankss
Hello,
A slider gives by default numbers without fraction, because the number of pixels (the visual size) equals the range. If you change the range or the visual size, you'll notice that the slider can give numbers with fraction too.
Katja
thankyou for this answer !
just to be clear, the [int] object doesn't round to an integer, it chops off the fractional part of the number leaving you with the number of whole parts of the value
(i.e., it always rounds down)
is there a [round] object yet?
You can do it with [expr]:
[expr if($f1<0, int($f1-.5), int($f1+.5))]
It's not 100% perfect because negative numbers with a fractional part of exactly .5 round down instead of up, but all other values should go in the right direction.
Oops! Looks like something went wrong!