12

I'm a programmer by trade by I've run into a weirdly special number and need some help deciphering its significance.

I was writing some machine learning code that compiles into GPU kernel code and the compiler output the number 1.000000015047466E+30 as part of its generated code. It doesn't seem to be a common number of interest from the field of CS (e.g. it's not a power of $2$).

Google searching for this constant just yields a handful of results that seem to suggest it may be a physical constant of some kind:

I'm absolutely baffled I have absolutely no clue why this number is appearing in my ML code and why it's also being used in hard science research and fractal art. It lends me to believe this number has some special properties, but I'm not sure what. Any leads would be greatly appreciated.

user21820
  • 60,745

1 Answers1

19

Could be the single precision floating point number closest to 10^30, so the number you’d get in say C if you write float x = 1e30. You’d need a floating point number with a 70 bit mantissa to represent 10^30 exactly.

gnasher729
  • 10,611
  • 20
  • 38
  • 2
    I've tried it (try e.g. printf("%.6f", (float)1e30);): it turns out to be $1.000000015047466\color{red}{21987668885504}e+30$. The question now is why $\pm10^{30}$ is used, as an extremum or otherwise. – J.G. Mar 31 '22 at 21:43
  • 3
    To get the same precision as OP is seeing you can write also printf("%.15e\n", 1e30f);. The value $10^{30}$ is not mysterious at all, you can try the same with $10^{20}$ and you will find out that value 1.000000020040877e+20 is used on many places as welll, probably most other powers of $10$ will be used somewhere... – Sil Mar 31 '22 at 21:50
  • 2
    @Sil Thanks for the improved C. I don't use it much. – J.G. Mar 31 '22 at 21:51
  • 1
    You can see it in the IEEE-754 simulator here https://www.h-schmidt.net/FloatConverter/IEEE754.html . Paste your number into "decimal representation". You'll see the binary rep of the mantissa ends ....10. If you flip those last two to ...01 you get 9.9999993949e+29 – Dan Apr 01 '22 at 08:22