Closed faassen closed 6 months ago
I don't plan to add that rounding mode to Dashu now, because this rounding mode is rather rarely used. You can implement the rounding mode in your application, because the requirement for the rounding mode is just to implement the Round
trait.
Please refer to https://github.com/cmpute/dashu/blob/4329c5cc67fa9798924888bb5cdd495dba96e566/float/src/round.rs#L288-L321 for an implementation example.
Thanks for the tip! Given that the rounding mode is rarely used, I now wonder how this spec ended up with it - seems a strange one to pick.
I have the same question... It's so counter-intuitive
I'm trying to implement this behavior with Dashu:
https://www.w3.org/TR/xpath-functions-31/#func-round
While dashu implements a rounding mode HalfAway, I think this requires HalfUp. Alternatively I take the absolute value, use HalfAway, and then reapply the sign, but that seems cumbersome.