Skip to content

Floating-point literals should store bits in integers, not use host f32/f64. #189

Open
@eddyb

Description

@eddyb

Compilers should never rely on host floating-point support, as that can lead to host-specific behavioral subtleties (instead of behavior being deterministically tied to the target architecture/platform), and in many cases there's not enough to gain to even look into what guarantees certain host architectures/platforms may offer.

For rustc we ported LLVM's C++ APFloat library to Rust (for e.g. evaluating float operations in constant expressions), but rspirv itself only needs to store literals, not operate on the actual values (and consumers could choose how to interpret the bits of a floating-point value, any way they want).

I'm not sure how what the timeline for 0.8 is, but this would be a breaking change.

Also, it would help with #16.

cc @khyperia

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