mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
classlib: improve accuracy of double parser and fix possible issue
This commit is contained in:
parent
b2aae0634e
commit
0a92994c4b
|
@ -134,10 +134,6 @@ public final class DoubleAnalyzer {
|
||||||
|
|
||||||
long c = (c3 << (32 + shift)) + (c2 << (16 + shift)) + (c1 << shift);
|
long c = (c3 << (32 + shift)) + (c2 << (16 + shift)) + (c1 << shift);
|
||||||
cm += c0 << 16;
|
cm += c0 << 16;
|
||||||
// TODO: removing this gives better result in random tests, however toString(1.0) gives '0.5'
|
|
||||||
if (((cm >>> (31 - shift)) & 1) != 0) {
|
|
||||||
++c;
|
|
||||||
}
|
|
||||||
c += cm >>> (32 - shift);
|
c += cm >>> (32 - shift);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
|
|
@ -39,6 +39,10 @@ public final class DoubleSynthesizer {
|
||||||
return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
|
return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
binMantissa += 1L << 4;
|
binMantissa += 1L << 4;
|
||||||
|
if ((binMantissa & (-1L << 58L)) != 0) {
|
||||||
|
binMantissa >>>= 1;
|
||||||
|
binExp++;
|
||||||
|
}
|
||||||
if (binExp <= 0) {
|
if (binExp <= 0) {
|
||||||
binMantissa >>= Math.min(-binExp + 1, 64);
|
binMantissa >>= Math.min(-binExp + 1, 64);
|
||||||
binExp = 0;
|
binExp = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user