bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Awk cannot properly deal with too small numbers.


From: david kerns
Subject: Re: [bug-gawk] Awk cannot properly deal with too small numbers.
Date: Thu, 14 Apr 2016 16:31:49 -0700

see https://en.wikipedia.org/wiki/Double-precision_floating-point_format

You're hitting the limits of double precision floating point ... perhaps awk could issue a warning when your "out of bounds" string is coerced into a number that becomes zero, but I'm guessing the community will vote no.

On Thu, Apr 14, 2016 at 9:44 AM, Zhengyu Guo <address@hidden> wrote:
Hi,

I encountered a problem when dealing with very small numbers. The test case this shown below

~~~
$ echo 1.1e-307 | awk '$1<0.05{print}'
1.1e-307
$ echo 1.1e-309 | awk '$1<0.05{print}’
~~~

Both commands should print out the input number. However, the second command print out nothing. 

It seems that when the numeric number is too small, AWK cannot process it correctly. 

Thanks!


reply via email to

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