Skip to content

Option for unchecked divison methods #9

@BioTurboNick

Description

@BioTurboNick

Julia's default integer division is checked. This occurs with division by 0, and typemin(T) ÷ -one(T).

LLVM deems either of these cases undefined behavior, which is very very bad because the compiler is allowed to do whatever it wants in that case. Also on Windows it may throw a Win32 exception that crashes Julia.

This is in contrast to +/-/*/^/abs where overflow has a defined result of wrapping around. And for example, C# doesn't stop checking division in an unchecked context. So it makes sense to not automatically follow this.

However, we could consider an option passed to the unchecked macros that allows people to opt in to unchecked division.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions