grpc
third_party
abseil-cpp
absl
numeric
internal
abseil-cpp/absl/numeric/internal/representation.h
Go to the documentation of this file.
1
// Copyright 2021 The Abseil Authors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
16
#define ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
17
18
#include <limits>
19
20
#include "absl/base/config.h"
21
22
namespace
absl
{
23
ABSL_NAMESPACE_BEGIN
24
namespace
numeric_internal {
25
26
// Returns true iff long double is represented as a pair of doubles added
27
// together.
28
inline
constexpr
bool
IsDoubleDouble
() {
29
// A double-double value always has exactly twice the precision of a double
30
// value--one double carries the high digits and one double carries the low
31
// digits. This property is not shared with any other common floating-point
32
// representation, so this test won't trigger false positives. For reference,
33
// this table gives the number of bits of precision of each common
34
// floating-point representation:
35
//
36
// type precision
37
// IEEE single 24 b
38
// IEEE double 53
39
// x86 long double 64
40
// double-double 106
41
// IEEE quadruple 113
42
//
43
// Note in particular that a quadruple-precision float has greater precision
44
// than a double-double float despite taking up the same amount of memory; the
45
// quad has more of its bits allocated to the mantissa than the double-double
46
// has.
47
return
std::numeric_limits<long double>::digits ==
48
2 * std::numeric_limits<double>::digits;
49
}
50
51
}
// namespace numeric_internal
52
ABSL_NAMESPACE_END
53
}
// namespace absl
54
55
#endif // ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition:
third_party/abseil-cpp/absl/base/config.h:171
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition:
third_party/abseil-cpp/absl/base/config.h:170
absl::numeric_internal::IsDoubleDouble
constexpr bool IsDoubleDouble()
Definition:
abseil-cpp/absl/numeric/internal/representation.h:28
absl
Definition:
abseil-cpp/absl/algorithm/algorithm.h:31
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:04