Article View: comp.os.os2.programmer
Article #1947Re: Gawk and floating-point numbers
From: min-woong sohn
Date: Thu, 08 Oct 1992 04:46
Date: Thu, 08 Oct 1992 04:46
33 lines
1516 bytes
1516 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).
>
I have no problem with mine. When I summed up from 1.01 to 1.1, I
got 1.55 using both print and printf "%.02f". There are two ports
of gawk 2.13 on ftp-os2, so you obviously need to try the other one.
Min
Technical Details
Message-ID:
<1992Oct8.044637.25641@midway.uchicago.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!news.gtech.com!noc.near.net!hri.com!ukma!darwin.sura.net!convex!news.oc.com!spssig.spss.com!uchinews!quads!soh3References:
<BvpIsC.CHx@news.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!news.gtech.com!noc.near.net!hri.com!ukma!darwin.sura.net!convex!news.oc.com!spssig.spss.com!uchinews!quads!soh3 From: soh3@quads.uchicago.edu (min-woong sohn) Newsgroups: comp.os.os2.programmer Subject: Re: Gawk and floating-point numbers Message-ID: <1992Oct8.044637.25641@midway.uchicago.edu> Date: 8 Oct 92 04:46:37 GMT References: <BvpIsC.CHx@news.cso.uiuc.edu> Sender: news@uchinews.uchicago.edu (News System) Reply-To: soh3@midway.uchicago.edu Organization: University of Chicago Lines: 33