@safe unittest | |
{ | |
import std.math.hardware; | |
import std.math.rounding : lrint; | |
FloatingPointControl fpctrl; | |
fpctrl.rounding = FloatingPointControl.roundDown; | |
assert(lrint(1.5) == 1.0); | |
fpctrl.rounding = FloatingPointControl.roundUp; | |
assert(lrint(1.4) == 2.0); | |
fpctrl.rounding = FloatingPointControl.roundToNearest; | |
assert(lrint(1.5) == 2.0); | |
} | |