delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/03/02:49:36

Date: Thu, 3 Feb 2000 08:08:45 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Giacomo Cau <G DOT Cau AT gruppoina DOT it>
cc: djgpp AT delorie DOT com
Subject: Re: Gawk 3.0.3 print error?
In-Reply-To: <01bf6d72$d4059c20$09cc010a@iws0334.inadg.gruppoina.it>
Message-ID: <Pine.SUN.3.91.1000203080825.3341C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 2 Feb 2000, Giacomo Cau wrote:

> > > >gawk "BEGIN{OFMT=\"%012.0f\";print OFMT,1,sprintf(OFMT,1)}"
> > > 
> > > %012.0f 1 000000000001
> > 
> > What seems to be the problem, exactly?  I don't see anything wrong
> > with this result; that's what I'd expect "%012.0f" to produce.
> > The leading zero > says to pad with zeros, and .0 says no
> > fractional digits.
> 
> the problem is not in the "sprintf" but is in the "print 1".
> In fact it seems that OFMT in not used to format numbers.

No, OFMT *is* used to format numbers: try 1.1 instead of 1, and you
will see it.

It seems like `print' only uses OFMT for floating point numbers, not
for integers.  I don't know if that's a bug, but I don't think there's
anything DJGPP-specific in this behavior.  So please post this report
to gnu.utils.bug, where Gawk maintainer(s) will give you a definitive
answer.  Please mention there that you are using the DJGPP port, in
case it's important.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019