Integer Maths
Christophe Lavarenne (Christophe.Lavarenne@inria.fr)
Fri, 29 Nov 1996 11:36:55 +0100 (MET)
Integer coordinates are generally adequate to address a computer modelized
space (except when the space is as huge as the universe), in particular a
computer display (pixel coordinates are <11bits integers).
Floating point rounding errors are uncontrolable and generate irregularities in
computer graphics. Try to draw a small circle using floating point, you'll
probably see dissymetries between the 4 quadrants.
Bresenham's algorithms use integer maths to draw lines and circles with pixels.
I remember a 3D graphics dynamic demo in Turbo-Forth (all sorts of wire-framed
objects, including a plane), all integer maths.
Chuck's OKAD generates the chips layout in CIF format, and displays it on the
screen, with the user modifying the origin and scale, all integer maths.
Although I wrote a "Cordic" floating point package with parametrable accuracy
(distributed by MPE until last year, see my article in EuroFORML'88), I very
rarely use floating point, never for computer graphics where 16bits integers
are always adequate (with regular mixed 16/32 bits integers ops).
But in number crunching applications, such as civil engineering, or astronomy,
or simulations, or digital signal processing, most programmers prefer to let
the hardware track a floating point than to spend a few minutes optimizing
fixpoint integer computations. This is probably the reason why all recent DSP
and workstation processors integrate a floating point unit. But misc won't.
CL