Or actually doing what they did here where it changes it to a
enum Value {
SimpleFloat(64bit value),
ComplexNan(Heap pointer)
Ptr(*const T)
}
You lose out on performance if you use the bit patterns in the float that most people don't use very much, but you keep the correctness.I'd be very unhappy if a compiler silently did this to me - it would make performance extremely hard to reason about. But it's not quite as bad as changing the semantics.