diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/bqn.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/bqn.js b/docs/bqn.js index edac15b5..8e6d6398 100644 --- a/docs/bqn.js +++ b/docs/bqn.js @@ -599,10 +599,16 @@ let primitives = dynsys(state => { return list(gl.map((g,i) => list([g,rt[i]]))); }); +let mathfn = f => { + f.prim=null; let p=runtime[61](f,0); // ⚇ + return f!==Math.atan2 && f!==Math.hypot + ? ((x,w) => {if ( has(w)) throw Error("Left argument not allowed"); return p(x);}) + : ((x,w) => {if (!has(w)) throw Error("Left argument required"); return p(x,w);}); +} let trig = "cos cosh sin sinh tan tanh".split(" "); let mathns = obj2ns(Math, trig.concat(trig.map(n=>"a"+n),"LN10 LN2 LOG10E LOG2E cbrt expm1 hypot log10 log1p log2 round trunc atan2".split(" ")), - f=>typeof f==="function"?(f.prim=null,runtime[61](f,0)):f + f=>typeof f==="function"?mathfn(f):f ); trig.map((_,i)=>{let f=mathns[i],g=mathns[i+trig.length]; f.inverse=g; g.inverse=f;}); |
