Skip to content

Wrong values with large float32s #5

@GregoryMorse

Description

@GregoryMorse

The method of casting to int32 and back to float32 to perform a round-to-nearest even floor, is invalid if the number is greater than or equal to +2^31 or strictly less than -2^31. The result of fmod should be zero (in fact at magnitudes of +/-2^24 this is already guaranteed by the mantissa limitation), yet it seems in this library that undefined behavior would occur as this is not checked. Therefore though claiming to be fast, it is also taking a sloppy shortcut so as to not be universal in values outside that range of float values when we know float32 has a range of around -2^127 to 2^127

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions