isn't doing 660 * 0.3 using floating point arithmetic? [ June 16, 2005: Message edited by: fred rosenberger ]

Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1044

4

posted

0

Originally posted by fred rosenberger: Ryan,

isn't doing 660 * 0.3 using floating point arithmetic?

[ June 16, 2005: Message edited by: fred rosenberger ]

In general, yes.

However since the values are "hardcoded" (we're only doing +/- 30% of 11 min, not x% of y min), we can use our own brains to do the floating point arithmetic, and then use Java (or whatever) to print out what turn out to be integers (or even Strings).

If we MUST show some calculations, we can still use the fact that the denominator of the simplest form fraction for 30% divides evenly into the base time (30%=3/10 and 10 gazinta 11*60 evenly) to allow us to use integer math: