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/modules/ROOT/pages/examples.adoc
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,10 +72,38 @@ Decimal Result: 100
72
72
[#examples_conversions]
73
73
== Conversions
74
74
75
+
[#examples_integer_conversions]
76
+
=== Integral Conversions
77
+
78
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/integral_conversions.cpp[example] shows how to construct an integral value from decimal type and vice versa, as well as the behavior
79
+
80
+
====
81
+
[source, c++]
82
+
----
83
+
include::example$integral_conversions.cpp[]
84
+
----
85
+
86
+
.Expected Output
87
+
....
88
+
Decimal QNAN converts to Integer Max
89
+
Decimal INF converts to Integer Max
90
+
decimal64_t pi: 3.141592653589793
91
+
std::uint32_t pi: 3
92
+
93
+
Conversions will be lossless
94
+
std::uint32_t max: 4294967295
95
+
decimal64_t from max: 4294967295
96
+
97
+
Conversions will be lossy
98
+
std::uint64_t max: 18446744073709551615
99
+
decimal32_t from max: 1.844674e+19
100
+
....
101
+
====
102
+
75
103
[#examples_binary_floating_conversions]
76
104
=== Binary Floating Point Conversions
77
105
78
-
.This https://github.com/cppalliance/decimal/blob/develop/examples/binary_float_conversions.cpp[example] shows show to construct a binary floating point value from decimal type and vice versa
106
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/binary_float_conversions.cpp[example] shows how to construct a binary floating point value from decimal type and vice versa, as well as the behavior
0 commit comments