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
A decimal number can be explicitly or implicitly constructed from an integer.
60
+
A decimal number can be explicitly constructed from an integer.
61
61
For example:
62
62
63
63
[source, c++]
64
64
----
65
-
boost::decimal::decimal64_t g = 1;
66
-
boost::decimal::decimal32_t h {-4};
65
+
boost::decimal::decimal32_t f {-4};
67
66
----
68
67
69
68
=== Construction from Binary Floating Point
@@ -79,34 +78,14 @@ boost::decimal::decimal128_t pi {3.14};
79
78
Construction from non-finite values (e.g. `std::numeric_limits<double>::quiet_NaN()`) will yield the same non-finite value in the resulting decimal value.
80
79
Overflow or underflow will construct infinity or 0.
81
80
82
-
NOTE: Due to the differences in decimal and binary floating point numbers there may be a difference in the resulting representation in decimal format, and thus it is not recommended to construct from binary floating point numbers
81
+
IMPORTANT: Due to the differences in decimal and binary floating point numbers there may be a difference in the resulting representation in decimal format, and thus it is not recommended to construct from binary floating point numbers
83
82
84
-
== Fundamental Operations
85
-
86
-
The fundamental operations of numerical types (e.g. `>`, `==`, `+`, etc.) are overloaded.
87
-
88
-
[source, c++]
89
-
----
90
-
#include <boost/decimal.hpp>
91
-
#include <cassert>
83
+
For more information see: xref:examples.adoc#examples_construction[Basic Construction]
auto new_lhs {lhs}; // Using auto is safe when constructring from existing decimal values
103
-
new_lhs += lhs;
104
-
105
-
assert(lhs < new_lhs);
85
+
== Fundamental Operations
106
86
107
-
return 0;
108
-
}
109
-
----
87
+
The fundamental operations of numerical types (e.g. `>`, `==`, `+`, etc.) are provided for each type, to include mixed type arithmetic (e.g. `decimal32_t` + `decimal64_t`), and between integers and decimal types.
88
+
For more information see: xref:examples.adoc#examples_promotion[Promotion and Mixed Decimal Arithmetic].
0 commit comments