kirill-stepanishin commented on code in PR #3340:
URL: https://github.com/apache/tinkerpop/pull/3340#discussion_r2990404673
##########
gremlin-js/gremlin-javascript/lib/structure/io/binary/internals/NumberSerializationStrategy.js:
##########
@@ -58,11 +58,10 @@ export default class NumberSerializationStrategy {
// INT32_MIN/MAX
return this.ioc.intSerializer.serialize(item, fullyQualifiedFormat);
}
- // eslint-disable-next-line no-loss-of-precision
- if (item >= -9223372036854775808 && item < 9223372036854775807) {
- // INT64_MIN/MAX
+ if (item >= Number.MIN_SAFE_INTEGER && item <= Number.MAX_SAFE_INTEGER) {
return this.ioc.longSerializer.serialize(item, fullyQualifiedFormat);
}
+ // Integers outside safe range are huge doubles that only appear
integral due to IEEE 754 precision loss
return this.ioc.doubleSerializer.serialize(item, fullyQualifiedFormat);
}
Review Comment:
Agreed. I updated GremlinLang to use `MAX_SAFE_INTEGER` while addressing the
comment above, so both paths are now consistent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]