forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary_math.js
More file actions
35 lines (35 loc) · 1.42 KB
/
library_math.js
File metadata and controls
35 lines (35 loc) · 1.42 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
addToLibrary({
emscripten_math_cbrt: (x) => Math.cbrt(x),
emscripten_math_pow: (x, y) => Math.pow(x, y),
emscripten_math_random: () => Math.random(),
emscripten_math_sign: (x) => Math.sign(x),
emscripten_math_sqrt: (x) => Math.sqrt(x),
emscripten_math_exp: (x) => Math.exp(x),
emscripten_math_expm1: (x) => Math.expm1(x),
emscripten_math_fmod: (x, y) => x % y,
emscripten_math_log: (x) => Math.log(x),
emscripten_math_log1p: (x) => Math.log1p(x),
emscripten_math_log10: (x) => Math.log10(x),
emscripten_math_log2: (x) => Math.log2(x),
emscripten_math_round: (x) => Math.round(x),
emscripten_math_acos: (x) => Math.acos(x),
emscripten_math_acosh: (x) => Math.acosh(x),
emscripten_math_asin: (x) => Math.asin(x),
emscripten_math_asinh: (x) => Math.asinh(x),
emscripten_math_atan: (x) => Math.atan(x),
emscripten_math_atanh: (x) => Math.atanh(x),
emscripten_math_atan2: (y, x) => Math.atan2(y, x),
emscripten_math_cos: (x) => Math.cos(x),
emscripten_math_cosh: (x) => Math.cosh(x),
emscripten_math_hypot: (count, varargs) => {
var args = [];
for (var i = 0; i < count; ++i) {
args.push({{{ makeGetValue('varargs', `i * ${getNativeTypeSize('double')}`, 'double') }}});
}
return Math.hypot.apply(null, args);
},
emscripten_math_sin: (x) => Math.sin(x),
emscripten_math_sinh: (x) => Math.sinh(x),
emscripten_math_tan: (x) => Math.tan(x),
emscripten_math_tanh: (x) => Math.tanh(x)
});