develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24091] Not OK: perl v5.8.1 on sgi6-irix-ld 6.5

Yitzchak Scott-Thoennes
October 7, 2003 15:31
Re: [perl #24091] Not OK: perl v5.8.1 on sgi6-irix-ld 6.5
Message ID:
On Tue, Oct 07, 2003 at 11:41:46PM +0200, Tels <> wrote:
> But why does 
> 	perl -le "print +(81**3)**(1/3)"
> print 81 and not 80.99999999999999? perldoc print only says that it will print 

See $# in perlvar.pod (admittedly a hard-to-find piece of documentation).

IEEE doubles have 53 bits of precision.  This works out to just shy of
15.9+ digits, and perl will use 15 digits when stringizing an NV
(actually something like sprintf "%.15g").  If perl tried to round up
to 16 digits, there would be many test failures, since e.g. print 8.2
would give 8.199999999999999. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About