satish.rpr has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I have an issue with PERL 5.8.x and later with respect to floating point numbers.The issue is as such. The below printf statement produces the output correctly in 5.6.1 whereas the output is different in 5.8.6.Is this is bug with the new version of PERL. Any workaround for this to get the output in 5.8.1 similar to that of 5.6.1.
printf("%.32g\n",0.99999999976716936);
Perl 5.6.1 output:
0.99999999976716936 --> GOOD
Perl 5.8.6 output:
0.99999999976716925 --> ERROR
printf("%.32g\n",0.99999999976716936);
Perl 5.6.1 output:
0.99999999976716936 --> GOOD
Perl 5.8.6 output:
0.99999999976716925 --> ERROR
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl 5.8.x floating point representation error
by davido (Cardinal) on Jan 21, 2009 at 04:45 UTC | |
by satish.rpr (Novice) on Jan 21, 2009 at 12:12 UTC | |
by BrowserUk (Patriarch) on Jan 21, 2009 at 12:40 UTC | |
by Anonymous Monk on Jan 21, 2009 at 12:49 UTC | |
Re: Perl 5.8.x floating point representation error
by gone2015 (Deacon) on Jan 21, 2009 at 21:20 UTC | |
Re: Perl 5.8.x floating point representation error
by gone2015 (Deacon) on Jan 25, 2009 at 20:32 UTC |
Back to
Seekers of Perl Wisdom