Range of double numbers?

Everything else that doesn't fall into one of the other PB categories.
rko
User
User
Posts: 21
Joined: Thu Jul 17, 2008 1:44 pm
Location: germany

Range of double numbers?

Post by rko »

hi,

can you plese tell me what the range of double is - for example like "8 bytes Real numbers with an approximate range of 4.19E-307 to 1.67E+308"

thanx
User avatar
STARGÅTE
Addict
Addict
Posts: 2226
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Range of double numbers?

Post by STARGÅTE »

the highest storable double is: ± 1.7976931348623157e308
the lowes positive double is: 2.2250738585072013e-308
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
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Range of double numbers?

Post by Keya »

it seems the maximum for Double might be slightly understated in the PB docs?

In C:

Code: Select all

printf("%f", DBL_MAX);
179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000
                ^
In PB, using the docs suggested max yields a slightly lower figure:

Code: Select all

dbl.d = 1.7976931348623157e+308 :  Debug StrD(dbl)
179769313486231550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                ^
But if i change that from "157e+" to "158e+" the output then matches that of the C output:

Code: Select all

dbl.d = 1.7976931348623158e+308 :  Debug StrD(dbl)
179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                ^
Post Reply