# What determines the value of $MaxNumber? What determines the value of $MaxNumber?

$MaxNumber  1.233433712981650*10^323228458  Mathematica can instantly calculate: 44787922!  1.0809571*10^323228455  But refuses to calculate: 44787923! During evaluation of In[3]:= General::ovfl: Overflow occurred in computation. >> Overflow[]  It seems like an arbitrary cutoff rather than a limitation of the system. • The documentation example has 1.556812216564510*10^323228429 while my computer (32 bit) says 5.297557459040040*10^323228467. Yet another computer (64 bit) says that same value you quote. – Szabolcs Jan 22 '12 at 20:29 ## 3 Answers If you calculate Log[2,Log[2,$MaxNumber]], you'll get 29.999999828017338886225739 which is remarkably close to 30. Therefore I conclude that Mathematica calculates with a 31-bit exponent (1 bit for the exponent's sign). Which means that if Mathematica uses the same ordering as IEEE floats (i.e. first sign bit, then exponent, then mantissa), the first 32 bits (i.e. exactly 4 bytes) of a Mathematica floating point number contain the sign and the exponent.

• This sounds plausible. Is there any reason it needs to be the case, especially on a 64-bit system? I realize these are almost meaninglessly large numbers but Mathematica handles other fringe cases. – Mr.Wizard Jan 22 '12 at 20:37
• Given that even on 64 bit systems, C-derived languages use 32-bit int, I can imagine that they once decided to implement the floating point format using int, and then didn't see the need to revise that decision because, after all, the numbers are large enough that you generally won't exceed them anyway. And every change has the potential to introduce new bugs. Of course that's just a guess; probably only Wolfram could give you a definitive answer. – celtschk Jan 22 '12 at 20:49
• I believe you are correct, except that in C an int can be any size greater than 16 bits. WRI probably chose 32 bits because that's the size of an int on all the platforms they currently support. Incidentally, in Mathematica 5.2, which was the first 64-bit version, the multiprecision implementation is not GMP as it is in current versions, and as a result $MaxNumber is larger (2.0931173222699136*^646456781). – Oleksandr R. Jan 31 '12 at 23:07 As it seems to depend on more than machine bits I'm curious what $MaxNumber various Mathematica installs have.

If your setup is different please fill in system information and Log2 @ Log2 @ $MaxNumber // Round in the table below: $$\begin{array}{r|c|c|l|c} \text{OS} & \text{Bits} & \text{Version} & \text{\\\MaxNumber} & \log_2\log_2\\ \hline \\ % v7 \text{Windows} & 32 & 7.0.1 & 5.297557459040040\times 10^{323228467} & 30 \\ \text{Linux} & 64 & 7.0.1 & 1.233433712981650\times 10^{323228458} & 30 \\ \text{Windows} & 64 & 7.0.1 & 1.233433712981650\times 10^{323228458} & 30 \\ % v8 \text{Windows} & 32 & 8.0.4 & 5.297557459040040\times 10^{323228467} & 30 \\ \text{Windows} & 64 & 8.0.4 & 1.233433712981650\times 10^{323228458} & 30 \\ \text{OS X} & 64 & 8.0.4 & 1.233433712981650\times 10^{323228458} & 30 \\ \text{Linux} & 64 & 8.0.4 & 1.233433712981650\times 10^{323228458} & 30 \\ % v9 \text{Windows} & 32 & 9.0.1 & 5.297557459040040\times 10^{323228467} & 30 \\ \text{Windows} & 64 & 9.0.1 & 2.174188391646043\times 10^{20686623745} & 36 \\ \text{OS X} & 64 & 9.0.1 & 8.768126706828697\times 10^{2711437152599256} & 53 \\ \text{Linux} & 64 & 9.0.1 & 8.768126706828697\times 10^{2711437152599256} & 53 \\ \text{Windows} & 64 & 10.1.0 & 1.605216761933662\times 10^{1355718576299609} & 52 \\ \text{Windows} & 64 & 10.2.0 & 1.605216761933662\times 10^{1355718576299609} & 52 \\ \text{Windows} & 64 & 10.3.1 & 1.605216761933662\times 10^{1355718576299609} & 52 \\ \text{OS X} & 64 & 10.4.1 & 1.605216761933662\times 10^{1355718576299609} & 52 \\ \text{Windows} & 64 & 11.0.0 & 1.605216761933662\times 10^{1355718576299609} & 52 \\ \text{Windows} & 64 & 11.3.0 & 1.605216761933662\times 10^{1355718576299609} & 52 \\ \text{OS X} & 64 & 12.1.0 & 1.605216761933662\times 10^{1355718576299609} & 52 \\ \text{Linux ARM} & 32 & 12.0.1 & 5.297557459040040\times 10^{323228467} & 30 \\ % Your data here \end{array}$$ • On OS X 64 15.5 with an iMac I have $MaxNumber 1.605216761933662*10^1355718576299609 and Log[2, Log[2, \$MaxNumber]] 51.9999999999999589961407511684709. Please update! – Steffen Jaeschke Jul 12 '20 at 19:25
• @SteffenJaeschke you miss Round – wuyudi Jul 13 '20 at 2:40

Just so you know, open source Maxima's "bfloat" function (which uses "fpprec" option defined from 0 to ∞ to set the machine precision) hasn't any limitations at all and theoretically can calculate up to infinity. However, in reality it depends on your hardware.