Welcome Guest.   Make a donation to an author on the site November 21, 2009, 04:24:54 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Check out our 2008 Best of the Web Year-end Wrap-up.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: What Every Computer Scientist Should Know About Floating-Point Arithmetic  (Read 3448 times)
mouser
First Author
Administrator
*****
Posts: 21,839



plarker mouser see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: August 14, 2006, 02:43:53 AM »

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/sourc...06-3568/ncg_goldberg.html

Quote
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.



from http://del.icio.us/
Logged
f0dder
Charter Honorary Member
***
Posts: 6,147



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: August 14, 2006, 04:13:10 AM »

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.
Logged

- carpe noctem
app103
That scary taskbar girl
Charter Honorary Member
***
Posts: 2,718



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: August 14, 2006, 07:54:31 AM »

I recently went through some stress when I made the mistake of using floating point numbers to represent DonationCredits on this website. 

That's what you get for doing things the hard way instead of listening to me.  tongue
Logged

Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 5,841



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: August 14, 2006, 08:20:41 AM »

LOL - I could have warned you - never use real number representations where integer use is possible !!
« Last Edit: August 14, 2006, 10:22:35 AM by Carol Haynes » Logged

Things I like to do ... PlayOutdoors.co.uk ... Lairdswood.com ... and I support
rkarman
Supporting Member
**
Posts: 21


View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: August 14, 2006, 08:51:40 AM »

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 Wink
Logged

housetier
Charter Honorary Member
***
Posts: 1,036



http://nrrd.de/

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: August 14, 2006, 10:37:50 AM »

Here is a not-so-long aticle about problems with floating point arithmetic. I thought about opening a new thread but luckily I used my quicksearch-hack to find this thread.

...do we ever stop to think what goes on inside that floating point unit and whether we can really trust it?

I hate to cast aspersions on its good name but when I hear stories of space craft crashing, inconsistent information on bank statements and pensioners being short changed (...), I start to realise that there is a real danger of misusing floating point numbers...
© The Register.

I will look out for the follow-up article and hope it will be good.
Logged

::: Das Buch :::
Pages: [1]   Go Up
  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
SMF © 2006-2009, Simple Machines LLC

social bookmark this page