Interval Arithmetic

Wulfrick via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 29 14:04:00 PDT 2015


Is there an interval arithmetic library in D? I couldn’t find one.

In case I had to write my own, I understand that the IEEE 
standard floating point arithmetic provides operations for 
rounding up or down certain operations like summing, subtracting, 
etc. (thus overriding the default behavior of rounding to nearest 
representable).

How do I access this functionality in D? At first I thought that 
std.math.nextDown and nextUp is what I needed, but not so. 
Apparently these functions return the previous or next 
representable *after* the calculation has been done.

For example, I would like the value of x+y rounded in the 
arithmetic towards -\infty, which may or may not be nextDown(x+y).

Any luck?
Thanks for reading!



More information about the Digitalmars-d-learn mailing list