Floating point numbers are a subset of rational numbers. Just like 1/3 cannot be exactly represented by a finite decimal number (0.33333.....), as it cannot be represented by a finite expansion of powers of ten, numbers that can't be represented as a finite sum of powers of two cannot be represented as floating point numbers. There are quite a few programmers (see na-net) who have to deal with this all the time, as when trying to solve a 100000 DOF finite element model. Most perlists don't have to do such things (that sort of programming is still largely done in Fortran, although C++ is becoming more prevalent). In other words, it's expected behavior unless you're using a package like Macsyma or Maple.
See, for example, "What Every Programmer Should Know about Floating Point" by David Goldberg.
emc
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
In reply to Re: strange result for a simple addition ??
by swampyankee
in thread strange result for a simple addition ??
by Marsel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |