Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TurboWarp breaks any operations that depend on negitive 0 and the value not being NaN #100

Open
Tacodiva opened this issue Dec 7, 2022 · 2 comments

Comments

@Tacodiva
Copy link

Tacodiva commented Dec 7, 2022

A simple example is ( ( 1 / 0 ) / ( -0 + -0 ) ) which returns -Infinity in TurboWarp but Infinity in Scratch
image

See demo project 773175910 on Scratch and TurboWarp.

This happens because ( 1 / 0 ) = Infinity and ( -0 + -0) = -0. If you double click the ( -0 + -0) block in Scratch it will report 0, but internally it is still -0, it looks like 0 because (-0).toString() is 0. ( Infinity / -0 ) = -Infinity, so Scratch handles the block correctly.

TurboWarp on the other hand turns the -0 into a 0 leaving ( Infinity / 0 ) = Infinity. This happens because TurboWarp tries to deal with the potential NaN using || 0. This operation inadvertently also converts -0 into 0, as (-0) || 0 === 0.

@GarboMuffin
Copy link
Member

Known issue with no recorded project breakage so far

@Tacodiva
Copy link
Author

Tacodiva commented Dec 7, 2022

This will be mitigated with the better type analysis, as more NaN checks will be able to be omitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants