forked from dmonad/lib0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
math.js
38 lines (34 loc) · 784 Bytes
/
math.js
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
/**
* @module math
*/
export const floor = Math.floor
export const ceil = Math.ceil
export const abs = Math.abs
export const imul = Math.imul
export const round = Math.round
export const log10 = Math.log10
export const log2 = Math.log2
export const log = Math.log
export const sqrt = Math.sqrt
/**
* @function
* @param {number} a
* @param {number} b
* @return {number} The sum of a and b
*/
export const add = (a, b) => a + b
/**
* @function
* @param {number} a
* @param {number} b
* @return {number} The smaller element of a and b
*/
export const min = (a, b) => a < b ? a : b
/**
* @function
* @param {number} a
* @param {number} b
* @return {number} The bigger element of a and b
*/
export const max = (a, b) => a > b ? a : b
export const isNaN = Number.isNaN