Here's a preview from my zine, Bite Size Linux! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
get the zine!
read the transcript!
a double is 64 bits
10011011 10011011 10011011 1011011
10011011 10011011 10011011 1011011
(the first digit is the sign, the next 11 digits are the exponent, the rest is the fraction)
± 2 ^ E - 1023 x 1.frac
That means there are 2^64 doubles.
The biggest one is about 2^1023
weird double arithmetic
2^52 + 0.2 = 2^52 (the next number after 2^52 is 2^52 + 1)
doubles get farther apart as they get bigger
betweeen 2^n and 2^n+1 there are always 2^52 doubles, evenly spaced
that means that the next double after 2^60 is 2^60 =64 (2^60 / 2^52)
Javascript only has doubles (no integers!)
2**53 9007199254740992
2**53+1 9007199254740992 (same number! uh oh!)
panel 5
person with short spiky hair, baffled: doubles are scary and their arithmetic is weird!
person with short curly hair, calm and reassuring: they’re very logical! just understand how they work and don’t use integers over 2^53 in Javascript <3