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

Re: [perl #20827] Unexpected scientific notation.

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
February 15, 2003 14:21
Subject:
Re: [perl #20827] Unexpected scientific notation.
Message ID:
20030215183204.GG287@Bagpuss.unfortu.net
On Tue, Feb 11, 2003 at 05:19:49PM -0500, John Peacock wrote:
> Abigail wrote:

> >I most certainly do think it's a bug. The number to be squared was
> >carefully picked to be less than the square root of 0x7FFFFFFFFFFFFFFF.
> 
> But the fact that _you_ know the exponent will fit doesn't easily translate 
> into Perl being able to forsee that.  I'll try and look at the core logic 
> when I get home.

It's documented in perlnumber.pod that

  Operators such as C<**>, C<sin> and C<exp> force arguments to floating point
  format.

and in perlop.pod:

    =head2 Exponentiation
    
    Binary "**" is the exponentiation operator.  It binds even more
    tightly than unary minus, so -2**4 is -(2**4), not (-2)**4. (This is
    implemented using C's pow(3) function, which actually works on doubles
    internally.)

Nicholas Clark


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About