Skip to content

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

@Tacodiva

Description

@Tacodiva

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions