InvalidOperationException | x is signaling NaN |
InexactException | the result is inexact |
x | rint(x) |
---|---|
NaN | NaN |
±∞ | ±∞ |
±0.0 | ±0.0 |
DecimalControl.resetFlags(ExceptionFlags.inexact); assert(rint(decimal32("9.9")) == 10); assert(DecimalControl.inexact); DecimalControl.resetFlags(ExceptionFlags.inexact); assert(rint(decimal32("9.0")) == 9); assert(!DecimalControl.inexact);
Returns the value of x rounded using the specified rounding _mode. If no rounding _mode is specified the default context rounding _mode is used instead. This function is similar to nearbyint, but if the rounded value is not exact it will throw InexactException