We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b1f690 commit ce98a1fCopy full SHA for ce98a1f
1 file changed
rhino/src/main/java/org/mozilla/javascript/NativeMath.java
@@ -781,8 +781,12 @@ private static Object sumPrecise(
781
782
// Handle all zeros (including empty input)
783
if (allZeros) {
784
- // Empty input or all zeros - return -0 for empty, appropriate zero for actual zeros
785
- return ScriptRuntime.wrapNumber(partialsSize == 0 || hasNegativeZero ? -0.0 : 0.0);
+ // Empty input should always return -0
+ if (partialsSize == 0) {
786
+ return ScriptRuntime.wrapNumber(-0.0);
787
+ }
788
+ // All zeros - return -0 if any negative zeros, otherwise +0
789
+ return ScriptRuntime.wrapNumber(hasNegativeZero ? -0.0 : 0.0);
790
}
791
792
// Sum partials
0 commit comments