Skip to content

Commit 861bb7c

Browse files
committed
Remove special casing from LongEmul.toDouble
Change-Id: I9be46c69dd38280658f694e9d3e75406efb910eb
1 parent 7ac0363 commit 861bb7c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

dev/core/super/com/google/gwt/lang/LongLib.java

-3
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,6 @@ public static String toBase64(long value) {
431431
}
432432

433433
public static double toDouble(LongEmul a) {
434-
if (LongLib.eq(a, Const.MIN_VALUE)) {
435-
return -9223372036854775808.0;
436-
}
437434
if (LongLib.lt(a, Const.ZERO)) {
438435
return -toDoubleHelper(LongLib.neg(a));
439436
}

dev/core/test/com/google/gwt/lang/LongLibTestBase.java

+9
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ public void testConversions() {
165165
assertEquals(-10, LongLib.toInt(longFromBits(0, -10)));
166166
assertEquals(-10, LongLib.toInt(longFromBits(100, -10)));
167167
assertEquals(-10, LongLib.toInt(longFromBits(-100000, -10)));
168+
169+
assertEquals(0d, LongLib.toDouble(LongLib.fromInt(0)));
170+
assertEquals(1d, LongLib.toDouble(LongLib.fromInt(1)));
171+
assertEquals(10d, LongLib.toDouble(LongLib.fromInt(10)));
172+
assertEquals(-1d, LongLib.toDouble(LongLib.fromInt(-1)));
173+
assertEquals(-10d, LongLib.toDouble(LongLib.fromInt(-10)));
174+
175+
assertEquals(-9.223372036854776E18, LongLib.toDouble(Const.MIN_VALUE));
176+
assertEquals(9.223372036854776E18, LongLib.toDouble(Const.MAX_VALUE));
168177
}
169178

170179
public void testDiv() {

0 commit comments

Comments
 (0)