Mail Archives: djgpp/2000/02/03/10:43:32
Eli Zaretskii wrote:
>
> 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.
It might not be GNU awk only either, but there is comp.lang.awk.
--
Weiqi Gao
weiqigao AT a DOT crl DOT com
- Raw text -