bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gawk 3.1.5h test results on interix


From: Andrew J. Schorr
Subject: Re: gawk 3.1.5h test results on interix
Date: Tue, 16 Oct 2007 17:07:59 -0400
User-agent: Mutt/1.4.2.2i

On Tue, Oct 16, 2007 at 10:55:34PM +0200, Aharon Robbins wrote:
> > --- fmtspcl.ok      Mon Oct 15 09:12:50 2007
> > +++ _fmtspcl        Mon Oct 15 09:12:50 2007
> > @@ -5,5 +5,10 @@
> >   gawk: ./fmtspcl.awk:6: warning: [s]printf: value NaN is out of range for 
> > `%d' format
> >   gawk: ./fmtspcl.awk:6: warning: [s]printf: value NaN is out of range for 
> > `%x' format
> >   gawk: ./fmtspcl.awk:6: warning: [s]printf: value NaN is out of range for 
> > `%d' format
> > +sprintf(%f,NaN) = NaN (!= -NaN)
> > +sprintf(%s,NaN) = NaN (!= -NaN)
> > +sprintf(%g,NaN) = NaN (!= -NaN)
> >   gawk: ./fmtspcl.awk:6: warning: [s]printf: value NaN is out of range for 
> > `%x' format
> > +sprintf(%x,NaN) = NaN (!= -NaN)
> >   gawk: ./fmtspcl.awk:6: warning: [s]printf: value NaN is out of range for 
> > `%d' format
> > +sprintf(%d,NaN) = NaN (!= -NaN)
> 
> It would appear that your library doesn't distinguish negative and positive 
> NAN values.
> Is that true?

Hmmm, it doesn't seem quite that simple to me.  If you look carefully at the
fmtspcl.awk code, the thread is something like this (some code deleted for
simplicity):

   function display(x,str,   res) {
       if ((res = sprintf("%f",x)) != str)
               printf "sprintf(%s,%s) = %s (!= %s)\n",
                      "%f",x,res,str
   }

   BEGIN {
      nan = sqrt(-1)
      nnan_str = sprintf("%f",-nan)

      display(-nan,nnan_str)
   }

This seems rather bewildering to me (that 'sprintf("%f",-nan)' returned
'-NaN' in the first instance inside BEGIN, but then behaved differently
inside the display function).  I hope that I'm reading the code improperly.
Does anybody else understand what's going on here?

Regards,
Andy




reply via email to

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