[chuck-users] Integer divisions

Hans Aberg haberg at math.su.se
Tue Dec 15 05:29:50 EST 2009

I find the integer divisions C rule is problematic when working with  
intervals. Suppose I have [8/7, 7/6, 7/6, 8/7] and implement it as
   [Interval.r(8/7), Interval.r(7/6), Interval.r(7/6), Interval.r(8/7)]
Then this is the same as:
   [Interval.r(0), Interval.r(0), Interval.r(0), Interval.r(0)]
One has to add ".0" one of the numerator/denominator:
   [Interval.r(8.0/7), Interval.r(7.0/6), Interval.r(7.0/6),  

One possible rule might be converting 32-bit int to 64-bit floats, and  
then only back to int when needed. The question if it then affects  
some ChucK legacy code.


More information about the chuck-users mailing list