Article View: comp.os.os2.programmer
Article #2340Gawk and floating-point numbers
From: Ben Cox
Date: Tue, 06 Oct 1992 15:52
Date: Tue, 06 Oct 1992 15:52
37 lines
1543 bytes
1543 bytes
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
Technical Details
Message-ID:
<BvpIsC.CHx@news.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!news.larc.nasa.gov!lll-winken!bu.edu!ai-lab!prep.ai.mit.edu!gnulistsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!news.larc.nasa.gov!lll-winken!bu.edu!ai-lab!prep.ai.mit.edu!gnulists From: thoth@uiuc.edu (Ben Cox) Newsgroups: comp.os.os2.programmer,gnu.utils.bug Subject: Gawk and floating-point numbers Message-ID: <BvpIsC.CHx@news.cso.uiuc.edu> Date: 6 Oct 92 15:52:59 GMT Reply-To: thoth@uiuc.edu (Ben Cox) Followup-To: comp.os.os2.programmer Organization: Ancient Illuminated Sears of Bavaria Lines: 37 Approved: info-gnu@prep.ai.mit.edu Originator: btc30679@uxa.cso.uiuc.edu Apparently-To: gnu-utils-bug@ux1.cso.uiuc.edu