How to detect overflow

Ola Fosheim Grøstad via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 4 02:01:25 PST 2015


On Wednesday, 4 November 2015 at 08:18:00 UTC, Ali Çehreli wrote:
> Thanks. I've noticed that the parameter of the subtraction 
> functions should be named 'underflow', no?

Integer math cannot underflow, unless you define division to be 
equivalent to division over reals.

overflow => higher/lower than max/min

underflow => wrongly rounded to zero  (smaller than epsilon)

Underflow can lead to unexpected division by zero errors in float 
expressions.


More information about the Digitalmars-d-learn mailing list