Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public Object visitFloatLiteral(final GremlinParser.FloatLiteralContext ctx) {
// parse D/d suffix as Double
return new Double(floatLiteral);
} else {
return new BigDecimal(floatLiteral);
return new Double(floatLiteral);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,12 @@ public static class ValidFloatLiteralTest {
@Parameterized.Parameters()
public static Iterable<Object[]> generateTestParameters() {
return Arrays.asList(new Object[][]{
{"1.1", "1.1", "java.math.BigDecimal"},
{"-0.1", "-0.1", "java.math.BigDecimal"},
{"1.0E+12", "1.0E12", "java.math.BigDecimal"},
{"-0.1E-12", "-0.1E-12", "java.math.BigDecimal"},
{"1E12", "1E12", "java.math.BigDecimal"},
// default
{"1.1", "1.1", "java.lang.Double"},
{"-0.1", "-0.1", "java.lang.Double"},
{"1.0E+12", "1.0E12", "java.lang.Double"},
{"-0.1E-12", "-0.1E-12", "java.lang.Double"},
{"1E12", "1E12", "java.lang.Double"},
// float
{"1.1f", "1.1", "java.lang.Float"},
{"-0.1F", "-0.1", "java.lang.Float"},
Expand Down Expand Up @@ -603,7 +604,7 @@ public void shouldParseGenericLiteralCollection() {
assertEquals(10, genericLiterals.get(1));

// verify 3rd element
assertEquals(new BigDecimal(14.5), genericLiterals.get(2));
assertEquals(new Double(14.5), genericLiterals.get(2));

// verify 4th element
assertEquals("hello", genericLiterals.get(3));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static Iterable<Object[]> generateTestParameters() {
{"gt(1.0D)", P.gt(1d)},
{"gte(1L)", P.gte(1L)},
{"inside(100, 200)", P.inside(100, 200)},
{"outside(1E11, 2e-11)", P.outside(new BigDecimal("1E11"), new BigDecimal("2e-11"))},
{"outside(1E11, 2e-11)", P.outside(new Double("1E11"), new Double("2e-11"))},
{"between(\"a\", \"e\")", P.between("a", "e")},
{"within([\"a\", \"e\"])", P.within(Arrays.asList("a", "e"))},
{"within()", P.within()},
Expand All @@ -73,7 +73,7 @@ public static Iterable<Object[]> generateTestParameters() {
{"P.gt(1.0D)", P.gt(1d)},
{"P.gte(1L)", P.gte(1L)},
{"P.inside(100, 200)", P.inside(100, 200)},
{"P.outside(1E11, 2e-11)", P.outside(new BigDecimal("1E11"), new BigDecimal("2e-11"))},
{"P.outside(1E11, 2e-11)", P.outside(new Double("1E11"), new Double("2e-11"))},
{"P.between(\"a\", \"e\")", P.between("a", "e")},
{"P.within([\"a\", \"e\"])", P.within(Arrays.asList("a", "e"))},
{"P.within()", P.within()},
Expand Down
Loading