[Top][All Lists]

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

Re: Bug with numeric calculation

From: Chuck Swiger
Subject: Re: Bug with numeric calculation
Date: Thu, 17 Aug 2006 11:07:17 -0700

On Aug 17, 2006, at 1:10 AM, Dr. C. Griewatsch wrote:
echo 1.0 1.1 | gawk '{print 0.1+$1-$2}'

echo 1.1 1.2 | gawk '{print 0.1+$1-$2}'

The same error can be reproduced with gawk 3.1.5 on the same machine, or
with gawk 3.1.0 on Solaris 5.8, and with gawk 3.1.4 on Suse 9.3.

Floating point numbers are represented at finite-precision binary values, which is discussed in considerable detail here:

http://en.wikipedia.org/wiki/Floating_point#Problems_with_floating- point


reply via email to

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