Skip to content

Use Math.imul(a, b) instead of a * b | 0 #2980

Open
@no-longer-on-githu-b

Description

@no-longer-on-githu-b

Math.imul correctly handles arithmetic overflow, whereas | 0 just discards the most significant bits. This affects purescript-prelude as well as the inliner. Using Math.imul would also make Semiring Int lawful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions