[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/111757] New: BigDecimal.setScale() should allow negative
From: |
guillerodriguez.dev at gmail dot com |
Subject: |
[Bug classpath/111757] New: BigDecimal.setScale() should allow negative scales |
Date: |
Tue, 10 Oct 2023 07:59:53 +0000 |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111757
Bug ID: 111757
Summary: BigDecimal.setScale() should allow negative scales
Product: classpath
Version: 0.99
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
Assignee: unassigned at gcc dot gnu.org
Reporter: guillerodriguez.dev at gmail dot com
Target Milestone: ---
BigDecimal.setScale() throws an ArithmeticException if the scale is negative.
The code contains this comment:
// NOTE: The 1.5 JRE doesn't throw this, ones prior to it do and
// the spec says it should. Nevertheless, if 1.6 doesn't fix this
// we should consider removing it.
if( scale < 0 ) throw new ArithmeticException("Scale parameter < 0.");
This is wrong: the specification of BigDecimal was actually changed from 1.4 to
1.5 to allow for negative scales (before 1.5, the scale could only be
positive).
Note that the current code in Classpath already supports negative scales (for
example, if specified in constructors). The above check can just be removed.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/111757] New: BigDecimal.setScale() should allow negative scales,
guillerodriguez.dev at gmail dot com <=