react / wstein / node_modules / browserify / node_modules / module-deps / node_modules / detective / node_modules / escodegen / node_modules / optionator / node_modules / prelude-ls / lib / Num.js
80690 views// Generated by LiveScript 1.4.01var max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm;2max = curry$(function(x$, y$){3return x$ > y$ ? x$ : y$;4});5min = curry$(function(x$, y$){6return x$ < y$ ? x$ : y$;7});8negate = function(x){9return -x;10};11abs = Math.abs;12signum = function(x){13if (x < 0) {14return -1;15} else if (x > 0) {16return 1;17} else {18return 0;19}20};21quot = curry$(function(x, y){22return ~~(x / y);23});24rem = curry$(function(x$, y$){25return x$ % y$;26});27div = curry$(function(x, y){28return Math.floor(x / y);29});30mod = curry$(function(x$, y$){31var ref$;32return (((x$) % (ref$ = y$) + ref$) % ref$);33});34recip = (function(it){35return 1 / it;36});37pi = Math.PI;38tau = pi * 2;39exp = Math.exp;40sqrt = Math.sqrt;41ln = Math.log;42pow = curry$(function(x$, y$){43return Math.pow(x$, y$);44});45sin = Math.sin;46tan = Math.tan;47cos = Math.cos;48asin = Math.asin;49acos = Math.acos;50atan = Math.atan;51atan2 = curry$(function(x, y){52return Math.atan2(x, y);53});54truncate = function(x){55return ~~x;56};57round = Math.round;58ceiling = Math.ceil;59floor = Math.floor;60isItNaN = function(x){61return x !== x;62};63even = function(x){64return x % 2 === 0;65};66odd = function(x){67return x % 2 !== 0;68};69gcd = curry$(function(x, y){70var z;71x = Math.abs(x);72y = Math.abs(y);73while (y !== 0) {74z = x % y;75x = y;76y = z;77}78return x;79});80lcm = curry$(function(x, y){81return Math.abs(Math.floor(x / gcd(x, y) * y));82});83module.exports = {84max: max,85min: min,86negate: negate,87abs: abs,88signum: signum,89quot: quot,90rem: rem,91div: div,92mod: mod,93recip: recip,94pi: pi,95tau: tau,96exp: exp,97sqrt: sqrt,98ln: ln,99pow: pow,100sin: sin,101tan: tan,102cos: cos,103acos: acos,104asin: asin,105atan: atan,106atan2: atan2,107truncate: truncate,108round: round,109ceiling: ceiling,110floor: floor,111isItNaN: isItNaN,112even: even,113odd: odd,114gcd: gcd,115lcm: lcm116};117function curry$(f, bound){118var context,119_curry = function(args) {120return f.length > 1 ? function(){121var params = args ? args.concat() : [];122context = bound ? context || this : this;123return params.push.apply(params, arguments) <124f.length && arguments.length ?125_curry.call(context, params) : f.apply(context, params);126} : f;127};128return _curry();129}130131