assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

fix: Use proper portable copysign polyfill

Open MaxGraey opened this issue 3 years ago • 0 comments

Previous one can't properly handle such edge cases:

copysign(1.0, +0.0)   ->  +0.0
copysign(1.0, -0.0)   ->  -0.0
copysign(1.0, +NaN)   ->  NaN
copysign(1.0, -NaN)   ->  NaN

Now, these cases don't change destination x argument. Only its sign:

copysign(1.0, +0.0)   ->  +1
copysign(1.0, -0.0)   ->  -1
copysign(1.0, +NaN)   ->  +1
copysign(1.0, -NaN)   ->  -1
  • [x] I've read the contributing guidelines
  • [x] I've added my name and email to the NOTICE file

MaxGraey avatar Sep 01 '22 08:09 MaxGraey