Date: Thu, 3 Feb 2000 08:08:45 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Giacomo Cau 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.