Hello TinkerPop Community,

Currently, when a floating-point number is provided without a suffix in Gremlin 
Lang (e.g., 1.0 or -123.456), it's automatically converted to a BigDecimal. 
This differs from most programming languages where floating-point literals 
without suffixes are typically treated as double-precision values.

I have created a PR targeting 3.8.x which changes GremlinLangScriptEngine to 
treat float literals as Double by default to align the behavior of Gremlin Lang 
with common programming language conventions and user expectations. This 
modification changes how floating-point literals without explicit type suffixes 
(like 'm', 'f', or 'd') are handled in the GenericLiteralVisitor class. Users 
who need BigDecimal precision can still use the 'm' suffix (e.g., 1.0m). 
Gremlin Groovy will be unchanged and still default to BigDecimal for float 
literals.

Please take a look if you have any concerns and leave a comment to open up 
discussion.

https://github.com/apache/tinkerpop/pull/3074

Thanks,

Andrea

Reply via email to