mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8289260: BigDecimal movePointLeft() and movePointRight() do not follow their API spec
Reviewed-by: darcy
This commit is contained in:
parent
9f37ba44b8
commit
35387d5cb6
2 changed files with 108 additions and 2 deletions
|
@ -2993,7 +2993,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||
* @throws ArithmeticException if scale overflows.
|
||||
*/
|
||||
public BigDecimal movePointLeft(int n) {
|
||||
if (n == 0) return this;
|
||||
if (n == 0 && scale >= 0) return this;
|
||||
|
||||
// Cannot use movePointRight(-n) in case of n==Integer.MIN_VALUE
|
||||
int newScale = checkScale((long)scale + n);
|
||||
|
@ -3017,7 +3017,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||
* @throws ArithmeticException if scale overflows.
|
||||
*/
|
||||
public BigDecimal movePointRight(int n) {
|
||||
if (n == 0) return this;
|
||||
if (n == 0 && scale >= 0) return this;
|
||||
|
||||
// Cannot use movePointLeft(-n) in case of n==Integer.MIN_VALUE
|
||||
int newScale = checkScale((long)scale - n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue