Hacker Newsnew | past | comments | ask | show | jobs | submit | icantremember's commentslogin

You want equality?

‘a.to_bits() == b.to_bits()’

Alternatively, use ‘partial_eq’ and fall back to bit equality if it returns None.


This would have worked if ieee hadn't severely messed up when (not) designing NaN semantics, but they did, so in rust, this can return false when comparing a NaN value to itself. (see the NaN section of https://doc.rust-lang.org/std/primitive.f32.html)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: