# stage2: hash/eql of fixed-size floats use bit pattern · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/c8531faaf56612773ef860d341f8eebb36af4bf3)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: c8531faaf56612773ef860d341f8eebb36af4bf3

Requested commit: c8531faaf56612773ef860d341f8eebb36af4bf3

Commit: c8531faaf56612773ef860d341f8eebb36af4bf3

Tree: b966d3a249d388be2f0591c4fef98d1e67071c33

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
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".

```

## Parents

- [6bc6e47b1582a4538078c8f4e9b3dae386854d07](https://git.cafe/gitcafe/zig/commit/6bc6e47b1582a4538078c8f4e9b3dae386854d07?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/c8531faaf56612773ef860d341f8eebb36af4bf3?format=markdown)
