blob: f6fad566f4be0bb3c3c61dc3904cfb70bbf60846 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
## Copyright (c) Eduardo Julian. All rights reserved.
## This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
## If a copy of the MPL was not distributed with this file,
## You can obtain one at http://mozilla.org/MPL/2.0/.
(;import lux)
## [Constants]
(do-template [<name> <value>]
[(def #export <name>
Real
(_jvm_getstatic "java.lang.Math" <value>))]
[e "E"]
[pi "PI"]
)
## [Functions]
(do-template [<name> <method>]
[(def #export (<name> n)
(-> Real Real)
(_jvm_invokestatic "java.lang.Math" <method> ["double"] [n]))]
[cos "cos"]
[sin "sin"]
[tan "tan"]
[acos "acos"]
[asin "asin"]
[atan "atan"]
[cosh "cosh"]
[sinh "sinh"]
[tanh "tanh"]
[ceil "ceil"]
[floor "floor"]
[exp "exp"]
[log "log"]
[cbrt "cbrt"]
[sqrt "sqrt"]
[->degrees "toDegrees"]
[->radians "toRadians"]
)
(def #export (round n)
(-> Real Int)
(_jvm_invokestatic "java.lang.Math" "round" ["double"] [n]))
(do-template [<name> <method>]
[(def #export (<name> x y)
(-> Real Real Real)
(_jvm_invokestatic "java.lang.Math" <method> ["double" "double"] [x y]))]
[atan2 "atan2"]
[pow "pow"]
)
|