General numerical speed



next up previous contents
Next: Using an expandable Up: DetailedEfficient, Algorithm Previous: DetailedEfficient, Algorithm

General numerical speed

On many computers, floating point computations are slower than integer, sometimes by a factor of three or more. Initially, when using 4 byte integers, we scale the map coordinates to the range in X and Y, where M=20,000. This allows us to calculate edge equations exactly since there is no overflow in calculating the numbers in the equation ; the largest number is under 800,000,000. Then we can substitute a point into the equation to determine which side of the edge it is on, again without any roundoff, since the largest number computed will be absolutely less than .

Nevertheless on some machines, floating point computations are now as fast as integers, so this step may not be as necessary in the future. Indeed, the Intel i860 processor does not even do integer multiplication. It multiplies two integers by treating them as floats to save space on the chip.



Wm Randolph Franklin
Wed Dec 14 14:03:28 EST 1994