TurboWarp / scratch-vm

Scratch VM with a JIT compiler and more features
https://turbowarp.org/
Mozilla Public License 2.0
74 stars 71 forks source link

-#/0 Returns positive Infinity with compiler off. #224

Open Da-Git-Thing opened 2 weeks ago

Da-Git-Thing commented 2 weeks ago

The output should return negative Infinity, but it returns positive Infinity, I'm unable to replicate the bug in another project in Turbowarp or vanilla scratch, I've tested this on Ubuntu Desktop & Firefox running Turbowarp.

image image

Tacodiva commented 2 weeks ago

Ok so there's two things happening here. The "0" here is not actually 0, it's "-0". In Scratch, -0 displays as just "0" so it's indistinguishable from a regular, non-negitive 0. The interpreter is actually treating this correctly and the compiler is handling it incorrectly. The compiler incorrectly treats -0 as 0 in this case because of #100.