Skip to content

Commit 0387a42

Browse files
committed
Add integral conversion example to doc page
1 parent f39522c commit 0387a42

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

doc/modules/ROOT/pages/examples.adoc

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,38 @@ Decimal Result: 100
7272
[#examples_conversions]
7373
== Conversions
7474
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+
75103
[#examples_binary_floating_conversions]
76104
=== Binary Floating Point Conversions
77105
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
79107
====
80108
[source,c++]
81109
----

0 commit comments

Comments
 (0)