@@ -300,14 +300,15 @@ export function configurePrecision (engine, constructor, compatible = true) {
300
300
let overflow = 0
301
301
for ( let i = 0 ; i < data . length ; i ++ ) {
302
302
const item = + data [ i ]
303
- if ( Number . isInteger ( data [ i ] ) ) res += item
303
+ if ( Number . isInteger ( item ) ) res += item
304
304
else {
305
305
res += item | 0
306
306
overflow += + ( '0.' + item . toString ( ) . split ( '.' ) [ 1 ] ) * 1e6
307
307
}
308
308
}
309
+
309
310
return res + ( overflow / 1e6 )
310
- } , { deterministic : true , sync : true } )
311
+ } , { deterministic : true , sync : true , optimizeUnary : true } )
311
312
312
313
engine . addMethod ( '*' , ( data ) => {
313
314
const SCALE_FACTOR = 1e6 // Fixed scale for precision
@@ -344,14 +345,14 @@ export function configurePrecision (engine, constructor, compatible = true) {
344
345
let overflow = 0
345
346
for ( let i = 1 ; i < data . length ; i ++ ) {
346
347
const item = + data [ i ]
347
- if ( Number . isInteger ( data [ i ] ) ) res -= item
348
+ if ( Number . isInteger ( item ) ) res -= item
348
349
else {
349
350
res -= item | 0
350
351
overflow += + ( '0.' + item . toString ( ) . split ( '.' ) [ 1 ] ) * 1e6
351
352
}
352
353
}
353
354
return res - ( overflow / 1e6 )
354
- } , { deterministic : true , sync : true } )
355
+ } , { deterministic : true , sync : true , optimizeUnary : true } )
355
356
356
357
engine . addMethod ( '%' , ( data ) => {
357
358
let res = data [ 0 ]
0 commit comments