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
All examples can be found in the library `examples/` folder as well.
11
+
The following examples will help you get up and running with many of the major parts of the library.
12
+
All of these examples can be found in the library `examples/` folder as well.
12
13
13
14
[#examples_construction]
14
15
== Basic Construction
15
-
.This example demonstrates the basic use of the various constructors offered by the decimal types
16
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/basic_construction.cpp[example] demonstrates the basic use of the various constructors offered by the decimal types
16
17
====
17
18
[source, c++]
18
19
----
@@ -35,7 +36,7 @@ Can not construct from invalid string
35
36
[#examples_promotion]
36
37
== Promotion and Mixed Decimal Arithmetic
37
38
38
-
.This example demonstrates the behaviors of promotion between types, and mixed decimal type arithmetic
39
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/promotion.cpp[example] demonstrates the behaviors of promotion between types, and mixed decimal type arithmetic
39
40
====
40
41
[source, c++]
41
42
----
@@ -56,7 +57,7 @@ The result of a + b is a decimal64_t: 9.1
56
57
[#examples_charconv]
57
58
== `<charconv>`
58
59
59
-
.This example demonstrates the fundamentals of the `<charconv>` like functions provided by the library
60
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/charconv.cpp[example] demonstrates the fundamentals of the `<charconv>` like functions provided by the library
60
61
====
61
62
[source, c++]
62
63
----
@@ -74,7 +75,7 @@ Value in scientific format with precision 20: -7.12345000000000000000e+06
74
75
75
76
[#examples_generic_programming]
76
77
== Generic Programming
77
-
.This example demonstrates how to write generic code that accepts both built-in floating point types, and decimal floating point values from this library
78
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/adl.cpp[example] demonstrates how to write generic code that accepts both built-in floating point types, and decimal floating point values from this library
78
79
====
79
80
[source, c++]
80
81
----
@@ -111,7 +112,7 @@ sin(-0.5) = -0.479426
111
112
112
113
[#examples_literals_constants]
113
114
== Literals and Constants
114
-
.This example demonstrates how to construct values using literals, and the usage of numerical constants that are provided by the library
115
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/literals.cpp[example] demonstrates how to construct values using literals, and the usage of numerical constants that are provided by the library
115
116
====
116
117
[source, c++]
117
118
----
@@ -138,7 +139,7 @@ pass:[{fmt}] support is available starting with pass:[C++14] so long as you have
138
139
[#examples_fmt_format]
139
140
=== `<fmt/format.hpp>`
140
141
141
-
.This example demonstrates the various formatting options provided by the library to support usage of pass:[{fmt}]
142
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/fmt_format.cpp[example] demonstrates the various formatting options provided by the library to support usage of pass:[{fmt}]
142
143
====
143
144
[source, c++]
144
145
----
@@ -212,7 +213,7 @@ You must include it yourself.
212
213
213
214
Taking the above example of pass:[{fmt}] and replacing all instances of `namespace fmt` with `namespace std` gives us another working example.
214
215
215
-
.This example demonstrates how to use `<format>` with the library in-place or in addition to pass:[{fmt}]
216
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/format.cpp[example] demonstrates how to use `<format>` with the library in-place or in addition to pass:[{fmt}]
216
217
====
217
218
[source, c++]
218
219
----
@@ -242,7 +243,7 @@ Scientific Format with Specified Precision and Padding:
242
243
243
244
[#examples_print]
244
245
=== `<print>`
245
-
.This example demonstrates how to use `<print>` with the library
246
+
.This https://github.com/cppalliance/decimal/blob/develop/examples/print.cpp[example] demonstrates how to use `<print>` with the library
Below are a few additional examples as to how the Decimal library can be used in the context of financial applications.
12
+
All of these examples can be found in the library `examples/` folder as well.
13
+
11
14
== Parsing Pricing Data from File
12
15
[#examples_money_parsing]
13
16
.This https://github.com/cppalliance/decimal/blob/develop/examples/numerical_parsing.cpp[example] demonstrates the numerical differences between parsing of monetary values between using `decimal32_t` and `float`
0 commit comments