Skip to content

Commit 9481c3b

Browse files
committed
Switch to using the xsum small accumulator
1 parent ca1964e commit 9481c3b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

quickjs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44727,7 +44727,7 @@ static JSValue js_math_sumPrecise(JSContext *ctx, JSValueConst this_val,
4472744727
JSValue iter, next, item, ret;
4472844728
int done;
4472944729
double d;
44730-
xsum_large_accumulator lacc;
44730+
xsum_small_accumulator acc;
4473144731
SumPreciseStateEnum state;
4473244732

4473344733
iter = JS_GetIterator(ctx, argv[0], /*async*/false);
@@ -44737,7 +44737,7 @@ static JSValue js_math_sumPrecise(JSContext *ctx, JSValueConst this_val,
4473744737
next = JS_GetProperty(ctx, iter, JS_ATOM_next);
4473844738
if (JS_IsException(next))
4473944739
goto fail;
44740-
xsum_large_init(&lacc);
44740+
xsum_small_init(&acc);
4474144741
state = SUM_PRECISE_STATE_MINUS_ZERO;
4474244742
for (;;) {
4474344743
item = JS_IteratorNext(ctx, iter, next, 0, NULL, &done);
@@ -44773,7 +44773,7 @@ static JSValue js_math_sumPrecise(JSContext *ctx, JSValueConst this_val,
4477344773
state = SUM_PRECISE_STATE_MINUS_INFINITY;
4477444774
else if (!(d == 0.0 && signbit(d)) && (state == SUM_PRECISE_STATE_MINUS_ZERO || state == SUM_PRECISE_STATE_FINITE)) {
4477544775
state = SUM_PRECISE_STATE_FINITE;
44776-
xsum_large_add1(&lacc, d);
44776+
xsum_small_add1(&acc, d);
4477744777
}
4477844778
}
4477944779
}
@@ -44792,7 +44792,7 @@ static JSValue js_math_sumPrecise(JSContext *ctx, JSValueConst this_val,
4479244792
d = -0.0;
4479344793
break;
4479444794
case SUM_PRECISE_STATE_FINITE:
44795-
d = xsum_large_round(&lacc);
44795+
d = xsum_small_round(&acc);
4479644796
break;
4479744797
default:
4479844798
abort();

0 commit comments

Comments
 (0)