diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-12-22 21:05:38 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-12-22 21:05:38 -0500 |
| commit | a472c6f1c6bf2f1f17a90ef510ede6162f739053 (patch) | |
| tree | 384a3595ce8b68562a824d41b2e1472a8402d8f9 | |
| parent | 3a0c9aeebef6a133396a270a67592c6b958ab79d (diff) | |
Check that argument to Floor is a number in VM
| -rw-r--r-- | docs/bqn.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/bqn.js b/docs/bqn.js index 954439a3..29201421 100644 --- a/docs/bqn.js +++ b/docs/bqn.js @@ -132,6 +132,10 @@ let log = (x,w) => { } throw Error("โโผ: Arguments must be numbers"); } +let floor = (x,w) => { + if (isnum(x)) return Math.floor(x); + throw Error("โ๐ฉ: Argument must be a number"); +} let lesseq = (x,w) => { let s=typeof w, t=typeof x; return +(s!==t ? s<=t : w<=x); @@ -186,7 +190,7 @@ let provide = [ ,times // ร ,divide // รท ,power // โ - ,(x,w) => Math.floor(x) // โ + ,floor // โ ,(x,w) => has(w)?+(x===w):x.sh?x.sh.length:0 // = ,lesseq // โค ,(x,w) => list(x.sh) // โข |
