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

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

Re: CONVFMT not (always?) honoured.


From: drj
Subject: Re: CONVFMT not (always?) honoured.
Date: Tue, 28 Oct 2003 17:33:05 +0000

In message <address@hidden>, Aharon Robbins writes:
> Hi. Re this:
> 
> > To: address@hidden
> > From: David Jones <address@hidden>
> > Subject: CONVFMT not (always?) honoured.
> > Date: Tue, 28 Oct 2003 14:39:00 +0000
> >
> > I was going to report this against my FreeBSD's default of 3.0.6 but I
> 
> Why is FreeBSD still so far back?

I don't know that it is.  I don't run a bleeding edge FreeBSD system you
know! :)


> > $ gawk313 'BEGIN{CONVFMT="%.2f";print (1/3)+"";a[1/3]=1;for(i in a)print i}
>>'
> > 0.333333
> > 0.33
> >
> > Cheers,
> >  drj
> 
> Nope, the behavior is correct. OFMT is still used when converting
> values for `print', while CONVFMT is only for number to string conversion.
> 
> Your use of `+' forces gawk to convert "" to 0.  That number is
> added to the numeric value of 1/3, which is converted by OFMT for printing.
> Using straight string concatenation will get you what you want:

Doh!  straight concatenation is of course what I wanted.  Thanks for
being patient (and having fixed the bug between 3.0.6 and 3.1.3).

drj




reply via email to

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