RFR: 8273346: Expand library mappings to IEEE 754 operations
Raffaello Giulietti
duke at openjdk.java.net
Wed May 25 09:37:11 UTC 2022
On Wed, 25 May 2022 00:19:41 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> Generally add apiNote's to map from Java library methods to particular IEEE 754 operations. For now, I only added such notes to java.lang.Math and not java.lang.StrictMath.
src/java.base/share/classes/java/lang/Math.java line 771:
> 769: * This method corresponds to the convertToIntegerTiesToEven
> 770: * operation defined in IEEE 754.
> 771: *
IEEE `convertToIntegerTiesToEven` rounds ties to the even integer.
The method's spec, however, requires ties to round toward positive infinity.
Unfortunately, IEEE 754 doesn't offer a `convertToIntegerTiesToPositive`
src/java.base/share/classes/java/lang/Math.java line 824:
> 822: * This method corresponds to the convertToIntegerTiesToEven
> 823: * operation defined in IEEE 754.
> 824: *
see comment for `round(float)`
src/java.base/share/classes/java/math/RoundingMode.java line 49:
> 47: * exponent range of {@code BigDecimal}, the mathematical result will
> 48: * be exactly representable in the result precision or fall between
> 49: * two representable values. In the case of falling between two
Perhaps better would be
`two adjacent representable values.`
-------------
PR: https://git.openjdk.java.net/jdk/pull/8876
More information about the core-libs-dev
mailing list