Posts tagged “Numbers”
4 posts Subscribe by RSS
4 posts
Why NaN === NaN is false: how ===, Object.is and includes compare values in JavaScript
In JavaScript, NaN === NaN is false but [NaN].includes(NaN) is true. The ECMA-262 rules for how ===, Object.is, and includes, Map and Set treat NaN and -0, with code.
What is 2147483647 + 1? Integer overflow in Java, Go, Rust, C and Python
In Java int, Go int32 and Rust i32, 2147483647 + 1 overflows: Java and Go wrap to a negative, Rust panics or wraps by Cargo profile, C's INT_MAX + 1 is undefined, Python gives 2147483648.
Why -7 % 3 gives different answers in different languages
-7 % 3 is 2 in Python but -1 in JavaScript, Java, C and Go. Truncated, floored and Euclidean division explained, and how to get a non-negative remainder.
Why 0.1 + 0.2 isn't 0.3: how floating-point numbers work
Why JavaScript, Python and Java print 0.30000000000000004 for 0.1 + 0.2, explained with the IEEE 754 double format, and how to compare, round and handle money safely.
No posts match. Try another word.