Skip to content

%intoffloat converts Infinity and NaN to 0 #6038

Closed
@glennsl

Description

@glennsl

This caught me by surprise. I expected it would raise an exception, similar to div by zero.

Is this behavior correct? If so, what is the rationale for it?

Repro:

int_of_float(infinity)
// or
int_of_float(nan)

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