1#ifndef __OPENTREP_BAS_FLOAT_UTILS_GOOGLE_HPP
2#define __OPENTREP_BAS_FLOAT_UTILS_GOOGLE_HPP
86 typedef unsigned __int64
UInt;
88 typedef long long Int;
89 typedef unsigned long long UInt;
123template <
typename RawType>
137 std::numeric_limits<RawType>::digits - 1;
222 return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
228 union FloatingPointUnion {
248 static Bits SignAndMagnitudeToBiased(
const Bits &sam) {
260 static Bits DistanceBetweenSignAndMagnitudeNumbers(
const Bits &sam1,
262 const Bits biased1 = SignAndMagnitudeToBiased(sam1);
263 const Bits biased2 = SignAndMagnitudeToBiased(sam2);
264 return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
267 FloatingPointUnion u_;
static const size_t kExponentBitCount
static const Bits kSignBitMask
FloatingPoint(const RawType &x)
bool AlmostEquals(const FloatingPoint &rhs) const
static const Bits kFractionBitMask
Bits fraction_bits() const
static const Bits kExponentBitMask
static RawType ReinterpretBits(const Bits bits)
TypeWithSize< sizeof(RawType)>::UInt Bits
static RawType Infinity()
Bits exponent_bits() const
static const size_t kMaxUlps
const Bits & bits() const
static const size_t kBitCount
static const size_t kFractionBitCount