Article View: comp.os.os2.programmer
Article #1921Re: Gawk and floating-point numbers
From: Ching-Tse Liu
Date: Wed, 07 Oct 1992 07:24
Date: Wed, 07 Oct 1992 07:24
48 lines
2195 bytes
2195 bytes
In article <BvpIsC.CHx@news.cso.uiuc.edu> thoth@uiuc.edu (Ben Cox) writes:
>I have been having a bit of trouble with floating-point numbers in
>Gawk (2.13, I think) under OS/2 2.0.
>
>I have a script which tallies up some figures (dollar amounts, so they
>are floats) and then tries to print them. I use a line something like
>
> printf "Total: %.02f, bleagh\n", total;
>
>and all I get is:
>
> Total: f, bleagh
>
>for output. Using this same script with Gawk under Linux worked fine,
>so naturally I assumed it would work with Gawk under OS/2.
>
>I also tried
>
> printf "Total:", total, ", bleagh";
>
>and that printed
>
> Total: 12510 , bleagh
>
>which isn't even close to correct ("total" is nowhere near 12510, or
>even 125.10).
>
>Anyone have any ideas of what I can do (other than moving my Gawk
>script and my data file to a unix machine)?
>
>Followups have been directed to comp.os.os2.programmer, since I read
>that group (and not gnu.utils.bug). :-)
>
>Any info would be helpful; thanks in advance!
>
>--
>Ben Cox
>thoth@uiuc.edu
I had the same problem and I asked the author of the port what
went wrong. It turned out that he inadvertently modified one of the lines in
the makefile and compiled it. But the source code and makefile that came
with the binary are the original intact ones. If you have the emx/gcc
development tool, yoou can do a simple make to get a working program.
***********************
--cliu@merlin.appmath.columbia.edu * CLifton T. Liu *
--cl45@cunixf.cc.columbia.edu ***********************
Technical Details
Message-ID:
<1992Oct7.072457.23756@news.columbia.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!gatech!rpi!usc!sol.ctr.columbia.edu!news.columbia.edu!cunixf.cc.columbia.edu!cl45References:
<BvpIsC.CHx@news.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rpi!usc!sol.ctr.columbia.edu!news.columbia.edu!cunixf.cc.columbia.edu!cl45 From: cl45@cunixf.cc.columbia.edu (Ching-Tse Liu) Subject: Re: Gawk and floating-point numbers Message-ID: <1992Oct7.072457.23756@news.columbia.edu> Sender: usenet@news.columbia.edu (The Network News) Nntp-Posting-Host: cunixf.cc.columbia.edu Reply-To: cl45@cunixf.cc.columbia.edu (Ching-Tse Liu) Organization: Columbia University References: <BvpIsC.CHx@news.cso.uiuc.edu> Date: Wed, 7 Oct 1992 07:24:57 GMT Lines: 49