mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-17 22:48:48 +00:00
8374202: Simplify significand normalization in BigDecimal(double, MathContext) constructor
Reviewed-by: rgiulietti
This commit is contained in:
parent
7e0a1499ee
commit
d58fb1e290
@ -1026,12 +1026,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
||||
return;
|
||||
}
|
||||
// Normalize
|
||||
while ((significand & 1) == 0) { // i.e., significand is even
|
||||
significand >>= 1;
|
||||
exponent++;
|
||||
}
|
||||
int scl = 0;
|
||||
int nTrailingZeros = Long.numberOfTrailingZeros(significand);
|
||||
significand >>= nTrailingZeros;
|
||||
exponent += nTrailingZeros;
|
||||
// Calculate intVal and scale
|
||||
int scl = 0;
|
||||
BigInteger rb;
|
||||
long compactVal = sign * significand;
|
||||
if (exponent == 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user