Skip to content

Commit 989e8dd

Browse files
committed
handle negative zero in copysign
1 parent 78ef848 commit 989e8dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/library.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1375,11 +1375,11 @@ LibraryManager.library = {
13751375
llvm_floor_f64: 'Math_floor',
13761376

13771377
llvm_copysign_f32: function(x, y) {
1378-
return y < 0 ? -Math_abs(x) : Math_abs(x);
1378+
return y < 0 || (y === 0 && 1/y < 0) ? -Math_abs(x) : Math_abs(x);
13791379
},
13801380

13811381
llvm_copysign_f64: function(x, y) {
1382-
return y < 0 ? -Math_abs(x) : Math_abs(x);
1382+
return y < 0 || (y === 0 && 1/y < 0) ? -Math_abs(x) : Math_abs(x);
13831383
},
13841384

13851385
round__asm: true,

0 commit comments

Comments
 (0)