Re: Euphoria bug found

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu