[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] missing function powm and friends
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] missing function powm and friends |
Date: |
Thu, 27 Nov 2014 14:45:24 -0500 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Nov 27, 2014 at 03:49:37PM +0100, Michael Plugge wrote:
> I wrote a small patch to use the powm() function (and also gcd() and
> next_prime()) of gmp; this works even for very large parameters and
> exponents. The appended patch file includes also an integer version of the
> routines. It would be really great if it could be integrated into gawk :-).
I wish we could simply package this as a shared library extension, but the
problem is that the extension mechanism passes numeric values as double
precision numbers and does not expose the MPFR/GMP numbers used with -M. The
gawk-mpfr extension converts numbers to strings in order to pass them between
gawk and the library, so that is one approach to dealing with this. My sense
is that there's a limited appetite for adding new functions to gawk, and a
preference for adding new functionality through extensions. So I suspect
that's a more fruitful approach to consider. But it is challenging when
considering extensions that would benefit from the arbitrary-precision
representation. Maybe it's worth giving some thought to how to enhance
the shared library interface to support alternate numeric representations.
That may be a big job.
Regards,
Andy