Gentle people,
Please find attached binom.apl.tgz. It contains the source for BINOM,
a defined function does what the primitive dyadic ! function does but
produces exact results over a larger range.
BINOM produces 1) the same results as ! over the range where !
produces exact integers, 2) exact integer results in range above that
produced by the ! but below the 9200000000000000000 upper limit of GNU
64-bit integers and 3) floating point results that match those of !
above the 64-bit integer upper limit.
In the interest of full disclosure:
1) The code is slow; 100 times slower than the primitive dyadic !. But
then BINOM is interpreted while ! is compiled in to the interpreter.
2) The code was presented in 1996 on comp.lang.apl by Jim Weigang and
others.
Enjoy,
Fred
Retired Chemical Engineer
binom.apl.tgz
Description: application/compressed-tar
