bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Overflow to Infinity


From: arnold
Subject: Re: [bug-gawk] Overflow to Infinity
Date: Tue, 19 Jun 2018 06:44:42 -0600
User-agent: Heirloom mailx 12.4 7/29/08

What system are you running on?  On a handy Linux system, I actually
get 'inf' for those values.

Thanks,

Arnold

Daniel Pettet <address@hidden> wrote:

> Hello,
>
> The following test program illustrates a problem with overflow of large
> numbers to what should be infinity.
>
> BEGIN {
>     n = split ("0 0.3 1e+30 1.2e+301 1.2e+311 1.2e+321 1.2e+331 1.2e+931
> 1.2e+9999 1.2e+9999999", a)
>
>     for (i=1; i<=n; ++i)
>         print a[i], +a[i]
> }
>
> With versions 4.1.4 and 4.2.1 the program output is:
>
> 0 0
> 0.3 0.3
> 1e+30 1000000000000000019884624838656
> 1.2e+301
> 12000000000000000630057123062453042984453622973297909858990249386141629495866898349436456500965374368524453325994606538123310278824325166907737506217440483794180646411118909644853962805537457080712427438819649599340973428467611690560895832913361709934951105465840682114057388033666356642385512806481920
> 1.2e+311 0
> 1.2e+321 0
> 1.2e+331 0
> 1.2e+931 0
> 1.2e+9999 0
> 1.2e+9999999 0
>
> The conversions to numbers result in zeros rather than infinities.
>
> Thanks.  Dan.



reply via email to

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