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 75d4a37 commit f8b7f8aCopy full SHA for f8b7f8a
tests/unittests/resources/RosettaSuite/calculating_value_of_e.ark
@@ -0,0 +1,20 @@
1
+(import std.Range :range)
2
+(import std.List)
3
+
4
+(let fact (fun (n acc) {
5
+ (if (> n 0)
6
+ (fact (- n 1) (* acc n))
7
+ acc) }))
8
9
+(let r (range 1 18))
10
+(let p
11
+ (list:sum
12
+ (list:map
13
+ (list:reverse (r.asList))
14
+ (fun (n)
15
+ (/ 1 (fact n 1)) ))))
16
17
+(import std.Math :abs)
18
19
+(let my_e (+ p 1))
20
+(assert (< (abs (- my_e math:e)) (toNumber "1e-15")) "computed e is near the math:e")
0 commit comments