bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] macOS: mpfrsqrt check fails on gawk-4.2-stable and master


From: Andrew J. Schorr
Subject: Re: [bug-gawk] macOS: mpfrsqrt check fails on gawk-4.2-stable and master branches
Date: Thu, 8 Feb 2018 13:03:48 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Feb 08, 2018 at 10:25:21AM -0700, address@hidden wrote:
> I've attached a patch that works on Linux and Cygwin.  Hermann, can
> you try this on MacOS X?  You should probably
> 
>       make distclean
>       patch -p1 < macosfix.diff
>       touch extension/Makefile.in extension/configure
>       ./configure && make && make check

You seem to be presuming that the problem on MacOS is in fact related to a
dynamic linking issue. I certainly hope so, because I can't think of any other
logical explanation. That being said, I'm not sure why the GMP or MPFR library
state matters for this calculation. The arguments passed to intdiv are all
AWK_NUMBER_TYPE_MPZ, so there is no need to convert the values (I confirmed
this with some debugging printfs). So all the code is really doing is getting
the arguments, passing them to mpz_tdiv_qr, and then populating the results
array. There are no conversions. So I don't see what state is at issue here...

Hermann -- if the dynamic linking issue doesn't fix the problem, please try
applying the attached patch and then executing:

   echo 
123456790123456790123456790123456790123456790123456790123454320987654320987654320987654320987654320987654320987654321
 1234567901234567901234567901234567901234567901234567901234 | 
AWKLIBPATH=extension/.libs ./gawk -M -l intdiv '{printf "%d\n", $1/$2; 
intdiv($1, $2, r); print r["quotient"]}'

Here's what I see on Linux:

bash-4.2$ echo 
123456790123456790123456790123456790123456790123456790123454320987654320987654320987654320987654320987654320987654321
 1234567901234567901234567901234567901234567901234567901234 | 
AWKLIBPATH=extension/.libs ./gawk -M -l intdiv '{printf "%d\n", $1/$2; 
intdiv($1, $2, r); print r["quotient"]}'
99999999999999997168788049560464200849936328366177157906432
converting mpz no-op
argument is 
123456790123456790123456790123456790123456790123456790123454320987654320987654320987654320987654320987654320987654321
converting mpz no-op
argument is 1234567901234567901234567901234567901234567901234567901234
quotient is 100000000000000000000000000000000000000000000000000000000044
100000000000000000000000000000000000000000000000000000000044

Thanks,
Andy

Attachment: intdiv_debug.patch
Description: Text document


reply via email to

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