4 ms·
My tl;dr of the article: 1. JavaScript's numbers behave better than C's! (All the behavior the author is praising is because the numbers are IEEE floating poin
by madhadron 5y ago
My tl;dr of the article:
1. JavaScript's numbers behave better than C's! (All the behavior the author is praising is because the numbers are IEEE floating point numbers and for most of JavaScript's history there weren't integer types. This was fine...until you started dealing with integers that didn't fit in the mantissa and you expected them to behave like integers.)
2. C works on too many kinds of computers and doesn't make assumptions I like! (Of course C can't guarantee that you have word lengths that are multiples of 8 bits, because it was—and probably still is somewhere—used on machines that don't have that. It can't provide standard ways to find out the endianness of the host because that may not be available from the host, or the host may support multiple endiannesses like x86 does. Of course C can't provide for 32 bit 2's complement integers because the hardware it runs on may not be 2's complement or 32 bit. Just pretend you're running on an exotic audio focused microcontroller with 12 bit words, 1's complement integers, and with endianness defined in the microcontroller's manual.)