Can somebody explain the implementation for is_nan() for the f64 primitive type?
It looks like this:
pub fn is_nan(self) -> bool {
self != self
}
More precisely I'm interested in what does self != self
mean...
You cand find the function described here:
https://doc.rust-lang.org/std/primitive.f64.html
And the implementation here:
https://doc.rust-lang.org/src/core/num/f64.rs.html#160-162
I was working through an example in chapter 17 of the Rust book, dealing with OOP Rust and I couldn't figure out why
assert_eq!(f64_value, f64::NAN);
would not work and I had to use
assert_eq!(f64_value.is_nan(), true);
Thanks,
Alex