> Define boundary conditions -- how much precision do you need?
imagine if integer arithmetic gave wrong answers in certain conditions lol why did we choose the current compromise?
imagine if integer arithmetic gave wrong answers in certain conditions lol why did we choose the current compromise?
It is odd to me that every major CPU instruction set has ALU codes to indicate when these conditions have occurred, and yet many programming languages ignore them entirely or make it hard to access them. Rust at least has the quartet of saturating, wrapping, checked, and unchecked arithmetic operations.
You get surprising things with common place problems.
Signed Integer Overflow OTOH is Undefined Behavior, so it's worse.