Re: Euphoria bug found
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 26, 2001
- 385 views
Irv Mullins writes: > Unfortunately, on 2.2 for Linux, it returns: > > 1.2345678912341 > 0 > 1 > 0 You shouldn't expect get() to always give you *precisely* the same floating-point value as you get from a literal constant. get() performs a lot of f.p. operations to arrive at its result. The interpreter might perform a slightly different series of calculations on the literal constant. In general, never expect floating-point numbers, or calculations on them, to be mathematically perfect. Any time you test two floating-point numbers for exact equality (or inequality) an alarm should go off in your head. The fact that there's a slight difference here between Linux and DOS/Windows, probably reflects the different C libraries, or different optimizations used in the C compilers. If you are getting answers that are imperfect, but correct to many significant digits, be happy. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com