andreachild commented on code in PR #3117:
URL: https://github.com/apache/tinkerpop/pull/3117#discussion_r2082101747
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/NumberHelper.java:
##########
@@ -361,8 +386,26 @@ public static Class<? extends Number>
getHighestCommonNumberClass(final boolean
*/
public static Number add(final Number a, final Number b) {
if (null == a || null == b) return a;
- final Class<? extends Number> clazz = getHighestCommonNumberClass(a,
b);
- return getHelper(clazz).add.apply(a, b);
+ NumberInfo numberInfo = getHighestCommonNumberInfo(false, a, b);
+ Number result = 0;
+ while (true) {
+ try {
+ final Class<? extends Number> clazz =
determineNumberClass(numberInfo.bits, numberInfo.fp);
+ result = getHelper(clazz).add.apply(a, b);
+ if (Double.isInfinite(result.doubleValue()))
+ {
+ throw new ArithmeticException("Floating point overflow
detected");
Review Comment:
We should not be throwing exception on double infinity
--
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]