Re: n accuracy




On Wed, 30 May 2007 14:17:09 +0300, "Alex Mizrahi" <udodenko@xxxxxxxxxxxxxxxxxxxxx> said:
| ...
| ??>> 2.7182817
| ??>> last value looks a bit strange, double and long versions have all
| ??>> digits correct.

| BM> What do you get if you simply type:
| BM> 2.7182818
| BM> ?

| it gets converted to ..17. it appears that single-presision IEEE 754 numbers
| are not able to represent that decimal value correctly.

No base-power-of-2 floating-point representation, including IEEE
754, can represent either 2.7182817 or 2.7182818 _exactly_; all of
them can, of course, represent both numbers _correctly_ according to
the rules of floating-point representations...

---Vassil,
in pedantic mode...


--
The truly good code is the obviously correct code.
.



Relevant Pages

  • Re: Exits after sleep; ideas?
    ... SkyFox wrote: ... It was the correct code; I switched boxes and it works on the other ... Apparently there's something strange going on with the system ...
    (comp.lang.ruby)
  • Re: n accuracy
    ... Thanks everybody I'll try with long-floats declarations and using the ... d0 suffix. ... ??>> last value looks a bit strange, double and long versions have all ... ??>> digits correct. ...
    (comp.lang.lisp)