We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9256ca5 commit c5a5043Copy full SHA for c5a5043
examples/udecimal_simpletest.py
@@ -0,0 +1,22 @@
1
+# SPDX-FileCopyrightText: 2020 Jeff Epler <https://unpythonic.net>
2
+#
3
+# SPDX-License-Identifier: Unlicense
4
+
5
+# pylint: disable=wrong-import-position,unused-import
6
7
+from jepler_udecimal import Decimal as D
8
+from jepler_udecimal import localcontext
9
10
+d = D(".1")
11
+e = D(".2")
12
+f = D(".3")
13
+g = D(".4")
14
+# Prints 0 because all values involved are exact decimals
15
+print(d + e + f + g - 1)
16
17
+import jepler_udecimal.utrig
18
19
+# Approximates pi to 78 decimal places
20
+with localcontext() as ctx:
21
+ ctx.prec = 78
22
+ print(D("1").atan() * 4)
0 commit comments