Test integerness: Difference between revisions
→{{header|Quackery}}: bug fix
(→{{header|Quackery}}: Added extra credit) |
(→{{header|Quackery}}: bug fix) |
||
Line 1,977:
Quackery uses bignums ("numbers" in the Quackery nomenclature) and comes with a bignum rational ("vulgars") arithmetic library. Quackery does not differentiate between two numbers on the stack and one vulgar. <code>v-is-num</code> returns true (1) if the top two numbers on the stack can be interpreted as a vulgar with no fractional component, and false (0) otherwise.
<code>
<lang Quackery> [ $ "bigrat.qky" loadfile ] now!
[ 1+ dip [ proper rot drop ]
▲ [ mod not ] is v-is-num ( n/d --> b )
▲ [ dip [ proper rot drop 0 1 ] approx= ] is approx0= ( n/d n --> b )</lang>
{{out}}
Line 1,999 ⟶ 2,000:
Stack empty.
/O> $ "25.000000" $->v drop 3
... $ "24.999999" $->v drop 3
... $ "25.000100" $->v drop 3
...
true
false▼
true
▲false
Stack empty.</pre>
|