Debian Codegraph @

libphobos/testsuite/libphobos.phobos/std_math_hardware.d

raw
1 @safe unittest
2 {
3 import std.math.hardware;
4
5 import std.math.rounding : lrint;
6
7 FloatingPointControl fpctrl;
8
9 fpctrl.rounding = FloatingPointControl.roundDown;
10 assert(lrint(1.5) == 1.0);
11
12 fpctrl.rounding = FloatingPointControl.roundUp;
13 assert(lrint(1.4) == 2.0);
14
15 fpctrl.rounding = FloatingPointControl.roundToNearest;
16 assert(lrint(1.5) == 2.0);
17 }
18