[chuck-users] Float to int

Spencer Salazar ssalazar at CS.Princeton.EDU
Fri Nov 3 21:30:07 EST 2006


Hey there!
try the typecast operator $ :

2.71828182845904523536 => float f;
f $ int => myBlit.harmonics;

Math.floor and friends are not totally necessary, but they are good  
if you want to guarantee a particular method of rounding off.

spencer

On Nov 3, 2006, at 6:18 PM, Laurie Hollander wrote:

> Sorry for the low level of this question, but....
> I'm trying to convert a floating point number to an int so I can chuck
> it to the blit harmonics parameter.   I've already used the math floor
> function on it, so it can be converted to an int without losing any
> information.   But I can't chuck it to an int without getting error
> messages, and I can't find any function that converts a float to an
> int in mini-Audicle or Chuck.    Is there a way to do this?
>
> Thank you!
>
> --laurie
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list