You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/tutorial_cpp_double_fp_backend.qbk
+17-16Lines changed: 17 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -24,26 +24,27 @@
24
24
} } // namespaces
25
25
26
26
The `cpp_double_fp_backend` back-end is the sum of two IEEE floating-point numbers
27
-
combined to create a type having rougly twice the composite width of one of its parts.
27
+
combined to create a type having a composite width rougly twice that as one of its parts.
28
28
The `cpp_double_fp_backend` back-end is used in conjunction with `number`
29
29
and acts as an entirely C++ header only floating-point number type.
30
30
31
31
The implementation relies on double-word arithmetic which is a technique
32
32
used to represent a real number as the sum of two floating-point numbers.
33
-
Other commonly used names for this include `double-double` of `double-word` arithmetic.
33
+
Other commonly used names for this include `double-double` or `double-word` arithmetic.
34
34
35
35
The `cpp_double_fp_backend` types have fixed width and do not allocate.
36
-
The type `cpp_double_double`, for instance, (composed of two double-precision IEEE floating-point numebers)
37
-
has (on most common systems) 106 binary digits of precision and approximately
36
+
The type `cpp_double_double`, for instance, is composed of two built-in `double` components.
37
+
On most common systems, built-in `double` is a double-precision IEEE floating-point number.
38
+
This results in a `cpp_double_double` that has 106 binary digits and approximately
38
39
32 decimal digits of precision.
39
40
40
-
The exponent ranges of the types are slightly limited (on the negative side) compared to those of the composite type.
41
-
Consider again the type `cpp_double_double`, composed of two double-precision IEEE double-precision
41
+
The exponent ranges of the types are slightly limited (on the negative side) compared to those of the composing type.
42
+
Consider again the type `cpp_double_double`, which is built from two double-precision IEEE double-precision
42
43
floating-point numebers. On common systems, this type has a maximum decimal exponent of 308
43
-
(as does a single double-precision floating point number). The negative minimum exponent, however,
44
-
is about -291, which is less range than the -307 from standalone double. The reason for
45
-
the limitation is because the composite lower-limb has lower value than its upper limb and would
46
-
underflow or become subnormal if the upper limb had its usual minimum value.
44
+
(the same as one single double-precision floating point number). The negative minimum exponent, however,
45
+
is about -291, which is less range than -307 from standalone double. The reason for
46
+
the limitation is because the composite lower-limb has lower value than its upper limb.
47
+
The composite type would easily underflow or become subnormal if the upper limb had its usual minimum value.
47
48
48
49
There is full standard library and `std::numeric_limits` support available for this type.
49
50
@@ -55,8 +56,8 @@ also in strict ANSI mode.
55
56
56
57
Run-time performance is a top-level requirement for the `cpp_double_fp_backend` types.
57
58
The types still do, however, support infinities, NaNs and (of course) zeros.
58
-
Signed negative zero, however, is not supported (in favor of efficiency)
59
-
and all zeros are treated as positive.
59
+
Signed negative zero, however, is not supported (in favor of efficiency).
60
+
All zeros are treated as positive.
60
61
61
62
The `cpp_double_fp_backend` types interoperate with Boost.Math and Boost.Math.Constants.
62
63
This offers the wealth of Boost-related mathematical tools instantiated with
@@ -66,19 +67,19 @@ Things you should know when using the `cpp_double_fp_backend` types:
66
67
67
68
* Although the types are created from two individual IEEE floating-point components, they specifically and clearly are not IEEE types in their composite forms.
68
69
* As a result these types can behave subtly differently from IEEE floating-point types.
69
-
* The types can not be used with compiler variations of _fast_-_math_ (i.e., `-ffast-math` on GCC can not be used and `/fp:precise` is mandatory on MSVC compilers). This is because the algorithms (particularly those for addition, subtraction, multiplicationand square root) rely on precise floating-point rouunding.
70
+
* The types can not be used with certain compiler variations of _fast_-_math_. On GCC/clang, for instance, `-ffast-math` can not be used (use either the default or explicitly set `-fno-fast-math`). On MSVC `/fp:fast` can not be used and `/fp:precise` (the default) is mandatory on MSVC compilers. This is because the algorithms, in particular those for addition, subtraction, multiplication, division and square root, rely on precise floating-point rounding.
70
71
* The composite types are not as precise as their constituents. For information on error-bounds, see Joldes et al. in the references below.
71
72
* There are `std::numeric_limits` specializations for these types.
72
73
* Large parts (but not all) of the `cpp_double_fp_backend` implementation are `constexpr`. Future evolution is anticipated to make this library entirely `constexpr`.
73
74
* Conversions to and from string internally use an intermediate `cpp_bin_float` value (which is a bit awkward may be eliminated in future refinements).
74
75
75
-
The `cpp_double_fp_backend` back-end has been inspired by original works and types such as the historical `doubledouble`
76
-
and more. These include the following:
76
+
The `cpp_double_fp_backend` back-end has been inspired by original works and types.
77
+
These include the historical `doubledouble` and more, as listed below.
77
78
78
79
* K. Briggs, the `doubledouble` library, 1998.
79
80
* V. Shoup, the class `quad_float` in the NTL number-theory library [@https://libntl.org].
80
81
* Yozo Hida, X. Li, and D. H. Bailey, Quad-Double Arithmetic: Algorithms, Implementation, and Application, Lawrence Berkeley National Laboratory Technical Report LBNL-46996 (2000). Also Y. Hida et al., Library for double-double and quad-double arithmetic [@https://web.mit.edu/tabbott/Public/quaddouble-debian/qd-2.3.4-old/docs/qd.pdf].
81
82
* Mioara Maria Joldes, Jean-Michel Muller, Valentina Popescu. Tight and rigourous error bounds for basic building blocks of double-word arithmetic. ACM Transactions on Mathematical Software, 2017, 44 (2), pp. 1 - 27. ff10.1145/3121432ff. ffhal-01351529v3f.
82
-
* The foundational `cpp_double_fp_backend` draft was originally created by Fahad Syed in BoostGSoC2021 _multiprecision_ [@https://github.com/BoostGSoC21/multiprecision].
83
+
* The foundational `cpp_double_fp_backend` draft was originally created by Fahad Syed in Boost GSoC2021 multiprecision project. Its source code can be found at [@https://github.com/BoostGSoC21/multiprecision].
0 commit comments