Decimal
suggest changeBitwise NOT (~) converts its operand with ToInt32, which truncates toward zero, then flips the 32 bits. ~3.5 is ~3. For an integer n, ~n equals -(n + 1), so the result is -4.
let number = 3.5;
let complement = ~number; // -4
let a = ~-2.5; // 1
let b = ~-1.5; // 0
let c = ~0.5; // -1
let d = ~1.5; // -2
let e = ~2.5; // -3
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents