forked from purescript/purescript-numbers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumber.js
More file actions
80 lines (59 loc) · 1.46 KB
/
Copy pathNumber.js
File metadata and controls
80 lines (59 loc) · 1.46 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* globals exports */
export const nan = NaN;
const isNaNImpl = isNaN;
export { isNaNImpl as isNaN };
export const infinity = Infinity;
const isFiniteImpl = isFinite;
export { isFiniteImpl as isFinite };
export function fromStringImpl(str, isFinite, just, nothing) {
var num = parseFloat(str);
if (isFinite(num)) {
return just(num);
} else {
return nothing;
}
}
export const abs = Math.abs;
export const acos = Math.acos;
export const asin = Math.asin;
export const atan = Math.atan;
export const atan2 = function (y) {
return function (x) {
return Math.atan2(y, x);
};
};
export const ceil = Math.ceil;
export const cos = Math.cos;
export const exp = Math.exp;
export const floor = Math.floor;
export const log = Math.log;
export const max = function (n1) {
return function (n2) {
return Math.max(n1, n2);
};
};
export const min = function (n1) {
return function (n2) {
return Math.min(n1, n2);
};
};
export const pow = function (n) {
return function (p) {
return Math.pow(n, p);
};
};
export const remainder = function (n) {
return function (m) {
return n % m;
};
};
export const round = Math.round;
export const sign = Math.sign ? Math.sign : function(x) {
return x === 0 || x !== x ? x : (x < 0 ? -1 : 1);
};
export const sin = Math.sin;
export const sqrt = Math.sqrt;
export const tan = Math.tan;
export const trunc = Math.trunc ? Math.trunc : function(x) {
return x < 0 ? Math.ceil(x) : Math.floor(x);
}