Returns true iff this number is at most kMaxUlps ULP's away from rhs. In particular, this function: - returns false if either number is (or both are) NAN. - treats really large numbers as almost equal to infinity. - thinks +0.0 and -0.0 are 0 DLP's apart.
| 7088 | // - treats really large numbers as almost equal to infinity. |
| 7089 | // - thinks +0.0 and -0.0 are 0 DLP's apart. |
| 7090 | bool AlmostEquals(const FloatingPoint& rhs) const { |
| 7091 | // The IEEE standard says that any comparison operation involving |
| 7092 | // a NAN must return false. |
| 7093 | if (is_nan() || rhs.is_nan()) return false; |
| 7094 | |
| 7095 | return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) |
| 7096 | <= kMaxUlps; |
| 7097 | } |
| 7098 | |
| 7099 | private: |
| 7100 | // The data type used to store the actual floating-point number. |
no test coverage detected