28#ifndef DOUBLE_CONVERSION_DOUBLE_H_
29#define DOUBLE_CONVERSION_DOUBLE_H_
56 explicit Double(uint64_t d64) : d64_(d64) {}
58 : d64_(DiyFpToUint64(diy_fp)) {}
92 if (d64_ == kInfinity)
return Double(kInfinity).value();
98 return Double(d64_ - 1).value();
100 return Double(d64_ + 1).value();
107 return Double(d64_ + 1).value();
110 return Double(d64_ - 1).value();
153#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__)
161#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__)
197 m_minus =
DiyFp((v.
f() << 2) - 1, v.
e() - 2);
199 m_minus =
DiyFp((v.
f() << 1) - 1, v.
e() - 1);
201 m_minus.
set_f(m_minus.
f() << (m_minus.
e() - m_plus.
e()));
202 m_minus.
set_e(m_plus.
e());
203 *out_m_plus = m_plus;
204 *out_m_minus = m_minus;
217 return physical_significand_is_zero && (
Exponent() != kDenormalExponent);
232 if (order <= kDenormalExponent)
return 0;
233 return order - kDenormalExponent;
237 return Double(kInfinity).value();
241 return Double(kNaN).value();
247#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__)
256 static uint64_t DiyFpToUint64(
DiyFp diy_fp) {
257 uint64_t significand = diy_fp.
f();
258 int exponent = diy_fp.
e();
266 if (exponent < kDenormalExponent) {
269 while (exponent > kDenormalExponent && (significand &
kHiddenBit) == 0) {
273 uint64_t biased_exponent;
274 if (exponent == kDenormalExponent && (significand &
kHiddenBit) == 0) {
277 biased_exponent =
static_cast<uint64_t
>(exponent +
kExponentBias);
283 DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(
Double);
298 explicit Single(uint32_t d32) : d32_(d32) {}
319 return biased_e - kExponentBias;
352#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__)
360#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__)
389 m_minus =
DiyFp((v.
f() << 2) - 1, v.
e() - 2);
391 m_minus =
DiyFp((v.
f() << 1) - 1, v.
e() - 1);
393 m_minus.
set_f(m_minus.
f() << (m_minus.
e() - m_plus.
e()));
394 m_minus.
set_e(m_plus.
e());
395 *out_m_plus = m_plus;
396 *out_m_minus = m_minus;
416 return physical_significand_is_zero && (
Exponent() != kDenormalExponent);
422 return Single(kInfinity).value();
431 static const int kDenormalExponent = -kExponentBias + 1;
432 static const int kMaxExponent = 0xFF - kExponentBias;
433 static const uint32_t kInfinity = 0x7F800000;
434#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__)
435 static const uint32_t
kNaN = 0x7FBFFFFF;
437 static const uint32_t
kNaN = 0x7FC00000;
442 DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(
Single);
void set_f(uint64_t new_value)
void set_e(int32_t new_value)
static const int kSignificandSize
uint64_t AsUint64() const
static const uint64_t kSignificandMask
void NormalizedBoundaries(DiyFp *out_m_minus, DiyFp *out_m_plus) const
static const int kMaxExponent
static const uint64_t kQuietNanBit
bool IsSignalingNan() const
static const int kExponentBias
bool LowerBoundaryIsCloser() const
static const uint64_t kSignMask
DiyFp UpperBoundary() const
static int SignificandSizeForOrderOfMagnitude(int order)
double PreviousDouble() const
DiyFp AsNormalizedDiyFp() const
uint64_t Significand() const
double NextDouble() const
static const uint64_t kExponentMask
static const uint64_t kHiddenBit
static const int kSignificandSize
static const int kPhysicalSignificandSize
static const uint32_t kExponentMask
static const uint32_t kSignificandMask
DiyFp UpperBoundary() const
static const uint32_t kQuietNanBit
uint32_t AsUint32() const
uint32_t Significand() const
bool LowerBoundaryIsCloser() const
bool IsSignalingNan() const
void NormalizedBoundaries(DiyFp *out_m_minus, DiyFp *out_m_plus) const
static const uint32_t kSignMask
static const int kSignificandSize
static const uint32_t kHiddenBit
static const int kPhysicalSignificandSize
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static float uint32_to_float(uint32_t d32)
static uint32_t float_to_uint32(float f)
static double uint64_to_double(uint64_t d64)
static uint64_t double_to_uint64(double d)
#define DOUBLE_CONVERSION_ASSERT(condition)
#define DOUBLE_CONVERSION_UINT64_2PART_C(a, b)