Skip to content

Commit

Permalink
* Added a link to David Goldberg's floating point article
Browse files Browse the repository at this point in the history
  • Loading branch information
briandfoy committed Mar 22, 2010
1 parent 79ab39b commit 438fce0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions perlfaq4.pod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ numbers, dates, strings, arrays, hashes, and miscellaneous data issues.

=head2 Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?

For the long explanation, see David Goldberg's "What Every Computer
Scientist Should Know About Floating-Point Arithmetic"
(http://docs.sun.com/source/806-3568/ncg_goldberg.html).

Internally, your computer represents floating-point numbers in binary.
Digital (as in powers of two) computers cannot store all numbers
exactly. Some real numbers lose precision in the process. This is a
Expand Down

0 comments on commit 438fce0

Please sign in to comment.