C++ Compiling Problems
Matthew Miller
mattdm at mattdm.org
Mon May 23 15:17:24 UTC 2005
On Mon, May 23, 2005 at 08:45:19AM -0600, linux user wrote:
> > C doesn't do fixed-point.
> I don't know what is meant by this. If it means floating point, again this
> is incorrect. C is capable of performing computations with integers,
> floats, and doubles. What else is there?
Fixed point is a "lossless" way to represent decimal fractions. Standard
floating-point uses binary internally, and so "0.01" can't actually be
represented properly (just as 1/3 can't be represented completely in
decimal -- 0.33333...). Fixed point is generally implemented by using
integers and keeping track of where a decimal point ought to be. (Addition
is straightforward, multiplication/division gets an extra step.)
It's also not in the C++ standard library, as far as I know.
--
Matthew Miller mattdm at mattdm.org <http://www.mattdm.org/>
Boston University Linux ------> <http://linux.bu.edu/>
Current office temperature: 72 degrees Fahrenheit.
More information about the users
mailing list