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
+7-29Lines changed: 7 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,49 +105,28 @@ sin(-0.5) = -0.479426
105
105
decimal128_t:
106
106
sin(-0.5) = -0.479426
107
107
-sin(0.5) = -0.479426
108
-
----
108
+
....
109
+
====
109
110
110
111
[#examples_literals_constants]
111
112
== Literals and Constants
112
-
113
-
This example can be found in the `examples/` folder as https://github.com/cppalliance/decimal/blob/develop/examples/literals.cpp[literals.cpp].
114
-
113
+
.This example demonstrates how to construct values using literals, and the usage of numerical constants that are provided by the library
114
+
====
115
115
[source, c++]
116
116
----
117
117
include::example$literals.cpp[]
118
118
----
119
119
120
120
Expected Output:
121
-
----
121
+
....
122
122
32-bit Pi: 3.141593
123
123
64-bit Pi: 3.141592653589793
124
124
32-bit UDL Pi: 3.141593
125
125
Rounded UDL has the same value as the 32-bit constant
126
126
64-bit UDL Pi: 3.141592653589793
127
127
Rounded UDL has the same value as the 64-bit constant
128
-
----
129
-
130
-
[#examples_finance]
131
-
== Financial Applications
132
-
133
-
=== Simple Moving Average
134
-
135
-
In the examples folder there is a file named `moving_average.cpp`.
136
-
This example shows how to parse historical stock data from a file and use it.
137
-
This serves as a framework for other calculations for securities.
138
-
139
-
=== Currency Conversion
140
-
In the examples folder there is a file named `currency_conversion.cpp`.
141
-
This example shows how to simply convert currencies based off a given exchange rate.
142
-
143
-
[#examples_boost_math]
144
-
== Boost.Math Integration
145
-
146
-
=== Bollinger Bands
147
-
148
-
In the examples folder there is a file named `statistics.cpp`.
149
-
This example demonstrates how to parse a file, and then leverage Boost.Math to compute statistics of that data set culminating with the values of the Bollinger Bands.
150
-
This example could be extended with the simple moving average to create full bands based on the period of the moving average you would like.
128
+
....
129
+
====
151
130
152
131
[#examples_format]
153
132
== Formatting
@@ -263,7 +242,6 @@ Scientific Format with Specified Precision and Padding:
263
242
We can make one final change to our `<format>` example where instead of using `std::cout`, we use pass:[C++23's] `<print>`.
264
243
This example can be found in the `examples/` folder as https://github.com/cppalliance/decimal/blob/develop/examples/print.cpp[print.cpp].
Distributed under the Boost Software License, Version 1.0.
4
+
https://www.boost.org/LICENSE_1_0.txt
5
+
////
6
+
7
+
[#examples_finance]
8
+
= Financial Examples
9
+
:idprefix: financial_examples_
10
+
11
+
== Financial Applications
12
+
13
+
=== Simple Moving Average
14
+
15
+
In the examples folder there is a file named `moving_average.cpp`.
16
+
This example shows how to parse historical stock data from a file and use it.
17
+
This serves as a framework for other calculations for securities.
18
+
19
+
=== Currency Conversion
20
+
In the examples folder there is a file named `currency_conversion.cpp`.
21
+
This example shows how to simply convert currencies based off a given exchange rate.
22
+
23
+
[#examples_boost_math]
24
+
== Boost.Math Integration
25
+
26
+
=== Bollinger Bands
27
+
28
+
In the examples folder there is a file named `statistics.cpp`.
29
+
This example demonstrates how to parse a file, and then leverage Boost.Math to compute statistics of that data set culminating with the values of the Bollinger Bands.
30
+
This example could be extended with the simple moving average to create full bands based on the period of the moving average you would like.
0 commit comments