This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
isn't doing 660 * 0.3 using floating point arithmetic? [ June 16, 2005: Message edited by: fred rosenberger ]
Joined: Feb 18, 2005
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: