Even more math (#56)

Remaining implementations of JavaScript's Math functions (except sin/cos/tan), both double (Math) and single (Mathf) precision, ported from musl incl. tests from libc-test, plus some changes to match JS semantics. Also binds fmod to `%` and pow to `**`.
This commit is contained in:
Daniel Wirtz
2018-03-30 17:25:54 +02:00
committed by GitHub
parent e47a130771
commit 164f134053
29 changed files with 143290 additions and 15143 deletions

View File

@ -13,6 +13,7 @@ i - 1;
i * 1;
i / 1;
i % 1;
i ** 1;
i << 1;
i >> 1;
i >>> 1;
@ -31,6 +32,7 @@ i = i - 1;
i = i * 1;
i = i / 1;
i = i % 1;
i = <i32>(i ** 1);
i = i << 1;
i = i >> 1;
i = i >>> 1;
@ -42,6 +44,7 @@ i += 1;
i -= 1;
i *= 1;
i %= 1;
// i **= 1;
i <<= 1;
i >>= 1;
i >>>= 1;
@ -62,6 +65,7 @@ I - 1;
I * 1;
I / 1;
I % 1;
<f64>I ** 1;
I << 1;
I >> 1;
I >>> 1;
@ -80,6 +84,7 @@ I = I - 1;
I = I * 1;
I = I / 1;
I = I % 1;
I = <i64>(<f64>I ** 1);
I = I << 1;
I = I >> 1;
I = I >>> 1;
@ -91,6 +96,7 @@ I += 1;
I -= 1;
I *= 1;
I %= 1;
// I **= 1;
I <<= 1;
I >>= 1;
I >>>= 1;
@ -110,7 +116,8 @@ f + 1;
f - 1;
f * 1;
f / 1;
// f % 1;
f % 1;
f ** 1;
b = f < 1;
b = f > 1;
@ -122,12 +129,14 @@ f = f + 1;
f = f - 1;
f = f * 1;
f = f / 1;
// f = f % 1;
f = f % 1;
f = f ** 1;
f += 1;
f -= 1;
f *= 1;
// f %= 1;
f %= 1;
f **= 1;
var F: f64 = 0;
@ -141,7 +150,8 @@ F + 1;
F - 1;
F * 1;
F / 1;
// f % 1;
F % 1;
F ** 1;
b = F < 1;
b = F > 1;
@ -153,9 +163,11 @@ F = F + 1;
F = F - 1;
F = F * 1;
F = F / 1;
// F = F % 1;
F = F % 1;
F = F ** 1;
F += 1;
F -= 1;
F *= 1;
// F %= 1;
F %= 1;
F **= 1;