Currently, the arithmetic operations (e.g. multiply(), divide(), etc.) and other functions in Decimal64Utils (from dfp) and Decimal64MathUtils (from dfp-math) apparently support only one rounding rule: "Round to nearest, ties to even."
However, IEEE-754 standard also defines:
- Rounding to nearest, ties away from zero
- Round toward positive infinity
- Round toward negative infinity
- Round toward zero (truncation)
The last three are implemented on Intel hardware.
Could you add support for the remaining rounding rules of the IEEE-754 standard? Or at least for the last three?
This is how I see it in the API. For each method that requires rounding, add a similar one with the ability to specify a rounding rule, for example: long divide(long x, long y, RoundingMode mode).
Currently, the arithmetic operations (e.g.
multiply(),divide(), etc.) and other functions inDecimal64Utils(fromdfp) andDecimal64MathUtils(fromdfp-math) apparently support only one rounding rule: "Round to nearest, ties to even."However, IEEE-754 standard also defines:
The last three are implemented on Intel hardware.
Could you add support for the remaining rounding rules of the IEEE-754 standard? Or at least for the last three?
This is how I see it in the API. For each method that requires rounding, add a similar one with the ability to specify a rounding rule, for example:
long divide(long x, long y, RoundingMode mode).