It also makes it easy for addition and subtraction ... nothing special to do, just add the ints. Multiplication and division are slightly more complicated, but not much.
And for output, you can simply do mod 1000 to get the part after the comma, and div 1000 to get the part before the comma.
Main Topics
Browse All Topics





by: Infinity08Posted on 2007-11-23 at 09:30:28ID: 20339917
What you could do is store 3.5 as 3500 and 3.05 as 3050
That way, you can store the range -30.000 to 30.000 as the integers -30000 to 30000.