0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00

stage2: hash/eql of fixed-size floats use bit pattern

Zig guarantees the memory layout of f16, f32, f64, f80, and f128 which
means for generic function purposes, values of these types need to be
compared on the basis of their bits in memory. This means nan-packing
can be used with generic functions, for example.

For comptime_float, the sign is observable, whether it is nan is
observable, but not any more kinds of bit patterns are observable.

This fixes the std.fmt tests that check printing "-nan".
This commit is contained in:
Andrew Kelley 2022-06-30 00:54:03 -07:00
commit c8531faaf5