Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.

Commit 3707059

Browse files
committed
Initial commit
0 parents  commit 3707059

File tree

4 files changed

+145
-0
lines changed

4 files changed

+145
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/js/
2+
/externs/
3+
/node_modules/
4+
/bower_components/

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 PureScript
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

bower.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "purescript-math",
3+
"version": "0.0.0",
4+
"homepage": "https://github.com/purescript/purescript-math",
5+
"description": "Math functions",
6+
"keywords": [
7+
"purescript"
8+
],
9+
"license": "MIT",
10+
"ignore": [
11+
"**/.*",
12+
"node_modules",
13+
"bower_components",
14+
"examples",
15+
"externs",
16+
"js"
17+
]
18+
}

src/Math.purs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
module Math where
2+
3+
foreign import abs
4+
"function abs(n){\
5+
\ return Math.abs(n);\
6+
\}" :: Number -> Number
7+
8+
foreign import acos
9+
"function acos(n){\
10+
\ return Math.acos(n);\
11+
\}" :: Number -> Number
12+
13+
foreign import asin
14+
"function asin(n){\
15+
\ return Math.asin(n);\
16+
\}" :: Number -> Number
17+
18+
foreign import atan
19+
"function atan(n){\
20+
\ return Math.atan(n);\
21+
\}" :: Number -> Number
22+
23+
foreign import atan2
24+
"function atan2(y){\
25+
\ return function (x) {\
26+
\ return Math.atan2(y, x);\
27+
\ };\
28+
\}" :: Number -> Number -> Number
29+
30+
foreign import aceil
31+
"function aceil(n){\
32+
\ return Math.aceil(n);\
33+
\}" :: Number -> Number
34+
35+
foreign import cos
36+
"function cos(n){\
37+
\ return Math.cos(n);\
38+
\}" :: Number -> Number
39+
40+
foreign import exp
41+
"function exp(n){\
42+
\ return Math.exp(n);\
43+
\}" :: Number -> Number
44+
45+
foreign import floor
46+
"function floor(n){\
47+
\ return Math.floor(n);\
48+
\}" :: Number -> Number
49+
50+
foreign import log
51+
"function log(n){\
52+
\ return Math.log(n);\
53+
\}" :: Number -> Number
54+
55+
foreign import max
56+
"function max(n1){\
57+
\ return function(n2) {\
58+
\ return Math.max(n1, n2);\
59+
\ }\
60+
\}" :: Number -> Number -> Number
61+
62+
foreign import min
63+
"function min(n1){\
64+
\ return function(n2) {\
65+
\ return Math.min(n1, n2);\
66+
\ }\
67+
\}" :: Number -> Number -> Number
68+
69+
foreign import pow
70+
"function pow(n){\
71+
\ return function(p) {\
72+
\ return Math.pow(n, p);\
73+
\ }\
74+
\}" :: Number -> Number -> Number
75+
76+
foreign import round
77+
"function round(n){\
78+
\ return Math.round(n);\
79+
\}" :: Number -> Number
80+
81+
foreign import sin
82+
"function sin(n){\
83+
\ return Math.sin(n);\
84+
\}" :: Number -> Number
85+
86+
foreign import sqrt
87+
"function sqrt(n){\
88+
\ return Math.sqrt(n);\
89+
\}" :: Number -> Number
90+
91+
foreign import tan
92+
"function tan(n){\
93+
\ return Math.tan(n);\
94+
\}" :: Number -> Number
95+
96+
foreign import e "var e = Math.E;" :: Number
97+
foreign import ln2 "var ln2 = Math.LN2;" :: Number
98+
foreign import ln10 "var ln10 = Math.LN10;" :: Number
99+
foreign import log2e "var log2e = Math.LOG2E;" :: Number
100+
foreign import log10e "var log10e = Math.LOG10E;" :: Number
101+
foreign import pi "var pi = Math.PI;" :: Number
102+
foreign import sqrt1_2 "var sqrt1_2 = Math.SQRT1_2;" :: Number
103+
foreign import sqrt2 "var sqrt2 = Math.SQRT2;" :: Number

0 commit comments

Comments
 (0)