Skip to content

Improve user experience of getNaNPayload #10896

@tedgin

Description

@tedgin

std.math.getNaNPayload(x) quietly accepts any real number and extracts the bits that would hold a payload as if the argument where NaN. For example, getNaNPayload(7) returns 2097152 for 80-bit real.

I'm asking if the ddoc getNaNPayload function comment could be updated to mention that it is up to the caller to verify that the argument being passed to getNaNPayload is a NaN, otherwise the result will be nonsensical.

It would also be nice if a precondition contract could be added to verify that the input parameter is a 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