[Issue 9717] `std.math.round` rounds away from zero instead of to the nearest even integer
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Dec 6 09:05:23 PST 2015
https://issues.dlang.org/show_bug.cgi?id=9717
--- Comment #10 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
(In reply to Iain Buclaw from comment #9)
> (In reply to Denis Shelomovskij from comment #8)
> > This issue isn't fixed. It's state is WONTFIX.
> > I'm strictly against documenting current useless specification as people
> > either don't care about rounding or prefer bank rounding method as it is
> > less biased.
>
> There's rint/lrint?
Yes, there is a way to do it: ensure default rounding mode is set and call
`rint`. But there is still two function calls (i.e. one
`with(FloatingPointControl) assert(rounding == roundToNearest)`) if you control
rounding mode and even more calls if you don't.
My point is: why are we using C behavior for `round` when it is not a generally
wanted behaviour? It's like keeping C issues in D and I don't see any point of
it.
--
More information about the Digitalmars-d-bugs
mailing list