Hi Ramon,
any number can be written in exponential notation,
if for example we consider the following power of 2:
2^10 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 = 1024 = 1.024 * 10^3 = 1.024e+3
all of these writings are equivalent.

But if I use this code:
Var v As Double = 1.79769313486231570814527423731704357 * 10^308
Break
MessageBox v.ToString

at the break I get the same value.
I have not checked what is the result of the MessageBox, so perhaps the problem is only in the Break and what the debugger window shows.

Hi Ramon,
typically numbers are represented in computer memory in exponential notation, so if you define it in exponential notation, in the debugger window you see it in the same exponential notation.
In the above example 2^1000 is not written in exponential notation but as a power of base 2 and exponent 1000.
So it’s converted to exponential notation, and that’s what the debugger window shows.

If I do 1.79…*10^308, I get the correct value (and increasing it gives an inf value). If I do 2^1000, I get the correct answer of 1.07e+126. Are you saying you get 1.07e+126 for both cases?

It seems that there is a problem with huge numbers.
I’ve tried Var v As Double = 5e300/3
and in the debugger I see 1.6666666666666668e+126
curiously again +126

Hi Jeremie,
I confirm that the value you indicated is the correct one, and also the string you get from MessageBox(v.ToSting)
is correct.
But the debugger window still shows e+126

If you make conversions of (int/double) datatypes including Double you’d want to use CType perhaps

Var v As Double = CType(2.0 ^ 1000.0, Double) // <- check the result in the debugger
Var s As String = v.ToString // <- check the result in the debugger
Break

by the way the value of “v” in the debugger is a Xojo based conversion to string, out of your hands. Make sure you debug values you can show as you expect them to be so Var v As String above is giving you the v.ToString value, you can also try to show it as v.ToString(“0.000000000000000000000000000”) something like that.

Problem 2
Val(String) only uses the first 127 positions
Test code:

Dim s As String = "5000000000000000375872434582591043137357145321762041067414545511788829626212076023322705505488790177141329775194262631633387520"
Dim a1 As Double = Val(s)
Dim a2 As Double = Val(s + "00")
Dim a3 As Double = Val(s + "0000000000000000000000000000000000000000000000000000000000000000000")
Break

I guess “test” on Windows will show e+126
if we click the pencil for test_s we see:

and that is the exact same number as the BiggerNumberMBS result above:

What I think is happening:

IDE debugger showing a limited double but has the correct information internally. Showing e+126 in Windows and limiting to 127 digits in mac

Val() can’t handle strings with more than 127 characters, everything past that is converted to the same 127 digit double (not tested with all combinations)