Other Software > Developer's Corner
What Every Computer Scientist Should Know About Floating-Point Arithmetic
mouser:
I recently went through some stress when I made the mistake of using floating point numbers to represent DonationCredits on this website. Here is a LONG article (originally from 1991) on floating point representations, very cool though it's a LOT to take in..
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Floating-point arithmetic is considered an esoteric subject by many people. This is rather surprising because floating-point is ubiquitous in computer systems. Almost every language has a floating-point datatype; computers from PCs to supercomputers have floating-point accelerators; most compilers will be called upon to compile floating-point algorithms from time to time; and virtually every operating system must respond to floating-point exceptions such as overflow. This paper presents a tutorial on those aspects of floating-point that have a direct impact on designers of computer systems.
--- End quote ---
from http://del.icio.us/
f0dder:
floating-point is pretty evil... NEVER use floats (or doubles or extendeds or...) for anything involving money or other people's lives. S'ok for 3D graphics, though.
app103:
I recently went through some stress when I made the mistake of using floating point numbers to represent DonationCredits on this website. -mouser (August 14, 2006, 03:43 AM)
--- End quote ---
That's what you get for doing things the hard way instead of listening to me. :P
Carol Haynes:
LOL - I could have warned you - never use real number representations where integer use is possible !!
rkarman:
aside from not using floating point math but fixed point math, also watch out to design your database with the "decimal" type (fixed point) and not the "float" type ;)
Navigation
[0] Message Index
[#] Next page
Go to full version