e number calculation weird behaviour

Everything else that doesn't fall into one of the other PB categories.
User avatar
Psychophanta
Addict
Addict
Posts: 4977
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

e number calculation weird behaviour

Post 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)
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: e number calculation weird behaviour

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Psychophanta
Addict
Addict
Posts: 4977
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: e number calculation weird behaviour

Post by Psychophanta »

Yes I remember. Lots of 64 bit CPU, etc., but FPU left without a bit of any significative evolution since i387 :evil:
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Post Reply