4 ms·
Heh, I never realized doubles can fit a googol. I knew they work up to 1e300-ish, but never made this explicit connection.
by sannee 8y ago
Heh, I never realized doubles can fit a googol. I knew they work up to 1e300-ish, but never made this explicit connection.
- TillE 8y agoI'm usually extremely reluctant to use doubles past 2^52, when the minimum increment becomes larger than 1.0
- dagss 8y agoIn that case you should likely have used fixed point arithmetic to start with. Doubles larger than 2^52 are no different from smaller numbers in context of scientific computing etc. which is what floating point is for. E.g. in a particular numerical simulation you could bump above 2^52 by using units of nanometers or below by using units of kilometers... yet this is likely just a simple multiplicative factor and the result of the calculation does not change one bit because of what units of measurement you use. Getting closer to 10^300 and it is another story.
- dasyatidprime 8y ago“I would have liked to be able to represent (1 << 53) + 1 exactly, but all I have is JavaScript and importing a bignum library is a lot harder than just restricting the range” seems like an unfortunately common problem.
- simonbyrne 8y agoWell, only approximately: as a double it is actually 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104
- undersuit 8y agoIt still 'fits'. The box is just very weird and sometimes the object that comes out is slightly different in size, but at least it's predictable.