Hello,

It may be reasonable to replace a divide by zero with check for a floating-point -0.0 with a bit-level check, but the stated motivation is not reasonable.

The Java platform requires that floating-point divide by zero return an infinity (or NaN as the case may be) and it is *incorrect* and non-conformant to throw an ArithmeticException in that case. Such behavior violates the language the JVM specs.

Cheers,

-Joe


On 9/26/2018 9:33 AM, Nasser Ebrahim wrote:
Hello,

In java.text.DecimalFormat.format(), there is a validation to check
whether a number is negative zero or not and for that divide by zero is
used to check for negative infinity which caused the ArithmeticException
when SIGFPE is enabled in the system. Andrew has opened a bug on my
behalf. Thank you Andrew.

The corresponding bug is https://bugs.openjdk.java.net/browse/JDK-8211161.

The webrev and stand alone test case is uploaded to
http://cr.openjdk.java.net/~aleonard/8211161/.
The recreate step is documented in the bug description.

I have tested the fix with the test cases of the following bugs and
confirm that it is working.
https://bugs.java.com/view_bug.do?bug_id=4106658
https://bugs.java.com/view_bug.do?bug_id=4106667
https://bugs.java.com/view_bug.do?bug_id=4147706

I did not add any new jtreg test for the current issue as it is not
functional. Hope that is fine.

Kindly request you to review and comment.

Thank you,
Nasser Ebrahim


Reply via email to