At the risk of pointing out the obvious: (1-2^-24) × 2^128 ≈ 3.40282e+38 is the maximum finite single-precision (32-bit) floating-point value, (1-2^-53) × 2^1024 ≈ 1.79769e+308 is the maximum finite double-precision (64-bit) one, and 2^15 = 32767 and 2^31 = 2147483647 are of course the maximum signed 16-bit and 32-bit integer respectively. Also, 2^25 = 33554428 + 4 = 33554400 + 32, which I don’t see a good reason for.
Don’t know why browsers don’t use actual floating-point infinies (which, yes, obey a + Inf = Inf [edit: Inf not a] and a × Inf = (sgn a) Inf for finite a, which should in fact have been covered in either an assembly course or a numerics course). I’m guessing something on the Web ended up subtracting Inf - Inf = NaN and crapping out.
You wrote "a + Inf = a" but er, presumably you meant "a + Inf = Inf" where a is some finite float ?
These are intuitive mathematical properties but would need to also be underscored for the IEEE floats because the relationship between the reals (which we definitely can't generally handle with a computer) we learned in school and the floats implemented by today's machines is unclear to many programmers. You absolutely can't expect people whose only language is Javascript to understand e.g. "floats aren't normal" even to the level of laughing at a T-shirt joke.
At the risk of pointing out the obvious: (1-2^-24) × 2^128 ≈ 3.40282e+38 is the maximum finite single-precision (32-bit) floating-point value, (1-2^-53) × 2^1024 ≈ 1.79769e+308 is the maximum finite double-precision (64-bit) one, and 2^15 = 32767 and 2^31 = 2147483647 are of course the maximum signed 16-bit and 32-bit integer respectively. Also, 2^25 = 33554428 + 4 = 33554400 + 32, which I don’t see a good reason for.
Don’t know why browsers don’t use actual floating-point infinies (which, yes, obey a + Inf = Inf [edit: Inf not a] and a × Inf = (sgn a) Inf for finite a, which should in fact have been covered in either an assembly course or a numerics course). I’m guessing something on the Web ended up subtracting Inf - Inf = NaN and crapping out.
You wrote "a + Inf = a" but er, presumably you meant "a + Inf = Inf" where a is some finite float ?
These are intuitive mathematical properties but would need to also be underscored for the IEEE floats because the relationship between the reals (which we definitely can't generally handle with a computer) we learned in school and the floats implemented by today's machines is unclear to many programmers. You absolutely can't expect people whose only language is Javascript to understand e.g. "floats aren't normal" even to the level of laughing at a T-shirt joke.