bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Binomial function with extended exact result range beyond


From: Juergen Sauermann
Subject: Re: [Bug-apl] Binomial function with extended exact result range beyond that of primitive function
Date: Wed, 06 Aug 2014 17:29:43 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi Fred,

I did a small rework of the monadic ! function. It should now be
exact (well, as exact as ×/⍳N is) for integer arguments up to 170
(i.e. the max integer before DOMAIN ERROR is thrown),

Before it was calling tgamma() of libm.

There are still many cases where GNU APL calls libm functions
and replacing them all by more exact versions would be rather tedious.
There are often speed-precision trade-offs involved. Normally the
precision of libm functions is good enough. Let's fix issues on a
case-by-case basis when we find them.

/// Jürgen


On 08/06/2014 03:06 AM, Frederick H. Pitts wrote:
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]