Page 1 of 1

e number calculation weird behaviour

Posted: Sun Sep 26, 2021 12:06 pm
by Psychophanta
Hi.

Is there anyone able to clarify this behaviour?
The tip is just a simple way to approximate to the e number value, but the results are bizarre. :?

Code: Select all

Macro calculoe(valor=5)
  r.d=Pow(1+1E-valor#,1E#valor#)
  debug #e-r
EndMacro

calculoe(7)
calculoe(8)
calculoe(9)
calculoe(10)
calculoe(11)
calculoe(12)
calculoe(13)
calculoe(14)
calculoe(15)
calculoe(16)
calculoe(17)
calculoe(18)

Re: e number calculation weird behaviour

Posted: Sun Sep 26, 2021 4:23 pm
by STARGĂ…TE
Doubles have only ~16 precision decimal digits.
Adding 1 with 1e-16 is simple 1.
Even 1 plus 1e-12 is not precise enough to give the right result when exponential with 1e12

Re: e number calculation weird behaviour

Posted: Tue Sep 28, 2021 9:14 pm
by Psychophanta
Yes I remember. Lots of 64 bit CPU, etc., but FPU left without a bit of any significative evolution since i387 :evil: