Move fmod/fmodf to builtins and bind them to the '%' operator

This commit is contained in:
dcodeIO
2018-03-24 18:39:20 +01:00
parent 721d77012b
commit c80bf35747
21 changed files with 4378 additions and 4209 deletions

95
std/portable.d.ts vendored
View File

@ -193,6 +193,10 @@ declare function parseInt(str: string, radix?: i32): f64;
declare function parseI32(str: string, radix?: i32): i32;
/** Parses a floating point string to a 64-bit float. */
declare function parseFloat(str: string): f64;
/** Returns the 64-bit floating-point remainder of `x/y`. */
declare function fmod(x: f64, y: f64): f64;
/** Returns the 32-bit floating-point remainder of `x/y`. */
declare function fmodf(x: f32, y: f32): f32;
// Portable standard library
// Everything marked @deprecated is a temporary filler. Do not use.
@ -310,52 +314,55 @@ interface Iterable<T> {
interface Iterator<T> {}
declare namespace Math {
export const E: f64;
export const LN2: f64;
export const LN10: f64;
export const LOG2E: f64;
export const LOG10E: f64;
export const PI: f64;
export const SQRT1_2: f64;
export const SQRT2: f64;
export function abs(x: f64): f64;
export function acos(x: f64): f64;
export function acosh(x: f64): f64;
export function asin(x: f64): f64;
export function asinh(x: f64): f64;
export function atan(x: f64): f64;
export function atan2(y: f64, x: f64): f64;
export function atanh(x: f64): f64;
export function cbrt(x: f64): f64;
export function ceil(x: f64): f64;
export function clz32(x: f64): i32;
export function cos(x: f64): f64;
export function cosh(x: f64): f64;
export function exp(x: f64): f64;
export function expm1(x: f64): f64;
export function floor(x: f64): f64;
export function fround(x: f64): f32;
export function hypot(value1: f64, value2: f64): f64; // TODO: see std/math
export function imul(a: f64, b: f64): i32;
export function log(x: f64): f64;
export function log10(x: f64): f64;
export function log1p(x: f64): f64;
export function log2(x: f64): f64;
export function max(value1: f64, value2: f64): f64; // TODO: see std/math
export function min(value1: f64, value2: f64): f64; // TODO: see std/math
export function pow(base: f64, exponent: f64): f64;
export function random(): f64;
export function round(x: f64): f64;
export function sign(x: f64): f64;
export function sin(x: f64): f64;
export function sinh(x: f64): f64;
export function sqrt(x: f64): f64;
export function tan(x: f64): f64;
export function tanh(x: f64): f64;
export function trunc(x: f64): f64;
interface IMath {
readonly E: f64;
readonly LN2: f64;
readonly LN10: f64;
readonly LOG2E: f64;
readonly LOG10E: f64;
readonly PI: f64;
readonly SQRT1_2: f64;
readonly SQRT2: f64;
abs(x: f64): f64;
acos(x: f64): f64;
acosh(x: f64): f64;
asin(x: f64): f64;
asinh(x: f64): f64;
atan(x: f64): f64;
atan2(y: f64, x: f64): f64;
atanh(x: f64): f64;
cbrt(x: f64): f64;
ceil(x: f64): f64;
clz32(x: f64): i32;
cos(x: f64): f64;
cosh(x: f64): f64;
exp(x: f64): f64;
expm1(x: f64): f64;
floor(x: f64): f64;
fround(x: f64): f32;
hypot(value1: f64, value2: f64): f64; // TODO: see std/math
imul(a: f64, b: f64): i32;
log(x: f64): f64;
log10(x: f64): f64;
log1p(x: f64): f64;
log2(x: f64): f64;
max(value1: f64, value2: f64): f64; // TODO: see std/math
min(value1: f64, value2: f64): f64; // TODO: see std/math
pow(base: f64, exponent: f64): f64;
random(): f64;
round(x: f64): f64;
sign(x: f64): f64;
sin(x: f64): f64;
sinh(x: f64): f64;
sqrt(x: f64): f64;
tan(x: f64): f64;
tanh(x: f64): f64;
trunc(x: f64): f64;
}
declare const Math: IMath;
declare const JSMath: IMath;
declare namespace console {
/** @deprecated */
function log(message: string): void;