time-to-botec/squiggle/node_modules/@rescript/std/lib/es6/js_math.js
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

51 lines
766 B
JavaScript

import * as Js_int from "./js_int.js";
function unsafe_ceil(prim) {
return Math.ceil(prim);
}
function ceil_int(f) {
if (f > Js_int.max) {
return Js_int.max;
} else if (f < Js_int.min) {
return Js_int.min;
} else {
return Math.ceil(f);
}
}
function unsafe_floor(prim) {
return Math.floor(prim);
}
function floor_int(f) {
if (f > Js_int.max) {
return Js_int.max;
} else if (f < Js_int.min) {
return Js_int.min;
} else {
return Math.floor(f);
}
}
function random_int(min, max) {
return floor_int(Math.random() * (max - min | 0)) + min | 0;
}
var ceil = ceil_int;
var floor = floor_int;
export {
unsafe_ceil ,
ceil_int ,
ceil ,
unsafe_floor ,
floor_int ,
floor ,
random_int ,
}
/* No side effect */