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: Tue, 6 Feb 2018 15:58:51 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Feb 06, 2018 at 03:40:02PM -0500, Andrew J. Schorr wrote:
> But to be safe: was the intdiv extension also built with MPFR 3.1.6?
> I don't see this problem on Fedora 27 with MPFR 3.1.5. I'm building
> 3.1.6 now...

I don't see any difference with 3.1.6. I guess one obvious thing to try
is rebuilding with "./configure --enable-builtin-intdiv0", and then
patching test/mpfrsqrt.awk to replace "intdiv" with "intdiv0" and confirm
that it works correctly. As I understand it, when you run:

AWKLIBPATH=extension/.libs ./gawk -M -f test/mpfrsqrt.awk

you are seeing:

11111111111111111111111111111111111111111111111111111111111
11111111111111109867334288901275613641560219569226843684864

--- test/mpfrsqrt.awk   2018-02-06 15:26:01.321390000 -0500
+++ test/mpfrsqrt0.awk  2018-02-06 15:55:58.100818000 -0500
@@ -10,7 +10,6 @@
 # Running this program (sqrt-bug.awk):
 # --------------------------------------------------------------------
 
address@hidden "intdiv"
 BEGIN {
 a=11111111111111111111111111111111111111111111111111111111111
 print sqrt(a^2)
@@ -29,9 +28,9 @@ function sq_root(x, temp,r,z)
    z=0
    while (abs(z-temp)>1)
     { z=temp
-      intdiv(x,temp,r)
+      intdiv0(x,temp,r)
       temp=r["quotient"] + temp
-      intdiv(temp,2,r)
+      intdiv0(temp,2,r)
       temp=r["quotient"]
     }
    return temp

So what do you see when you run:

 ./gawk -M -f test/mpfrsqrt0.awk

And maybe also try:

--- test/mpfrsqrt.awk   2018-02-06 15:26:01.321390000 -0500
+++ test/mpfrsqrt1.awk  2018-02-06 15:57:49.248040000 -0500
@@ -10,17 +10,13 @@
 # Running this program (sqrt-bug.awk):
 # --------------------------------------------------------------------
 
address@hidden "intdiv"
 BEGIN {
 a=11111111111111111111111111111111111111111111111111111111111
 print sqrt(a^2)
 #print sq_root(a^2)
 
 # ADR: Added for gawk-4.1-stable which doesn't have built-in intdiv() function
-if (PROCINFO["version"] < "4.1.60")
-  print sq_root2(a^2)
-else
-  print sq_root(a^2)
+print sq_root2(a^2)
 }
 
 
 ./gawk -M -f test/mpfrsqrt1.awk

Thanks,
Andy



reply via email to

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