bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] [Fwd: BUG REPORT]


From: Aharon Robbins
Subject: Re: [bug-gawk] [Fwd: BUG REPORT]
Date: Tue, 07 Feb 2012 22:34:58 +0200
User-agent: Heirloom mailx 12.4 7/29/08

Hi. Re this.

> From: cyrus <address@hidden>
> To: address@hidden
> Date: Mon, 06 Feb 2012 14:59:30 -0400
> Subject: [bug-gawk] [Fwd: BUG REPORT]
>
> BEGIN {
> a=0.93
> b=0.62
> c=0.31
> d=b+c
>         if (a == d)
>                 print "success" a d
>         else print "Failure"
> }
>
> I'm using UBUNTU 11.1. and I have a 64bit OS.
>
> The script above returns failure. But it should be success. If you
> change the integers to round #'s then it returns success!!

It's not a bug. It's how floating point numbers work; they do not
mimic decimal arithmetic. Please see the node "Floating Point Issues"
in the gawk doc.

Thanks,

Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]