That value is chosen because it’s approx 2-1071, which when you multiply some double precision float by it will shift that number into the “subnormal range”, which will start rounding off binary digits. I’m sure in practice 10-322 will work fine as well if you try it.
Exactly! Once the exponent is at the lowest level we can start inserting zeros into the mantissa to get even smaller numbers, at the expense of losing digits of accuracy.
82
u/[deleted] Nov 25 '20
What monsters saw this and did not upvote it?
20
u/murtaza64 Nov 26 '20
This is fucking beautiful. Does the choice of mantissa matter here? Can you not just do 1e-322?
Edit: does binary vs decimal cause the requirement? I can't seem to justify it, although I can kind of suspect where this is going
10
u/veryusedrname Nov 26 '20
This is a two-liner to show how completely, ridiculously the whole web is fucked up.
2
u/trexdoor Nov 26 '20
Subtract .5 (if necessary) and convert to an integer? Is this not possible in CSS?
1
u/Honestly__nuts Nov 29 '20
madlad
0
u/[deleted] Nov 26 '20
[deleted] — view deleted comment