Skip to content

[RFC] Use saturated float to int casts by default #1541

Open
@MaxGraey

Description

@MaxGraey

standardized proposal

f64.MAX_VALUE as u64 -> 18446744073709551615
f64.MAX_VALUE as i64 -> 9223372036854775807
NaN as i64 -> 0

For small types it will be emulated:
f32.MAX_VALUE as u8 -> 255

currently we have traps in all this cases. For saving this behaviour we could use unchecked:
unchecked(f64.MAX_VALUE as u64) -> panic

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions