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: Hermann Peifer
Subject: Re: [bug-gawk] macOS: mpfrsqrt check fails on gawk-4.2-stable and master branches
Date: Thu, 8 Feb 2018 07:33:58 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 08.02.18 00:04, Andrew J. Schorr wrote:
> On Wed, Feb 07, 2018 at 10:01:35PM +0100, Hermann Peifer wrote:
>> $ echo
>> 123456790123456790123456790123456790123456790123456790123454320987654320987654320987654320987654320987654320987654321
>> 1234567901234567901234567901234567901234567901234567901234 | ./gawk -M
>> -l extension/.libs/intdiv.so '{printf "%d\n", $1/$2; intdiv($1, $2, r);
>> print r["quotient"]}'
>> 99999999999999997168788049560464200849936328366177157906432
>> 99999999999999997168788049560464200849936328366177157906432
>> $
>> $ echo
>> 123456790123456790123456790123456790123456790123456790123454320987654320987654320987654320987654320987654320987654321
>> 1234567901234567901234567901234567901234567901234567901234 | ./gawk -M
>> -l extension/.libs/intdiv.so -vPREC=400 '{printf "%d\n", $1/$2;
>> intdiv($1, $2, r); print r["quotient"]}'
>> 100000000000000000000000000000000000000000000000000000000044
>> 99999999999999997168788049560464200849936328366177157906432
> 
> Very interesting. And what happens if you use the intdiv0 function
> instead (with and without PREC=400?
> 

The intdiv0 function gives the expected result, both with and without
PREC=400.

Hermann

$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean

$ ./bootstrap.sh && ./configure --enable-builtin-intdiv0 && make -j
...

$ echo
123456790123456790123456790123456790123456790123456790123454320987654320987654320987654320987654320987654320987654321
1234567901234567901234567901234567901234567901234567901234 | ./gawk -M
'{printf "%d\n", $1/$2; intdiv0($1, $2, r); print r["quotient"]}'
99999999999999997168788049560464200849936328366177157906432
100000000000000000000000000000000000000000000000000000000044
$
$ echo
123456790123456790123456790123456790123456790123456790123454320987654320987654320987654320987654320987654320987654321
1234567901234567901234567901234567901234567901234567901234 | ./gawk -M
-vPREC=400 '{printf "%d\n", $1/$2; intdiv0($1, $2, r); print r["quotient"]}'
100000000000000000000000000000000000000000000000000000000044
100000000000000000000000000000000000000000000000000000000044
$




reply via email to

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