On Thu, Nov 14, 2002 at 07:58:55PM +0100, Angel Faus wrote: > It works just like the standard scientific notation: > the left portion of the C<e> is the coefficient, and the > right is the exponent, so a number of the form C<C.CCCeEE> > is actually intepreted as C<C.CCC * 10**EE>. > > For example, the literal C<7.828e6> is interpreted as > C<7823000>.
That must be some new math there where 7.828 * 10**6 is 7823000 :-) I'd write out the steps: 7.828e6 -> 7.828 * 10**6 -> 7.828 * 1000000 -> 7828000 > =section ** Underscore character as a seprator > > Perl allows the underscore character, C<_>, to be placed as > a separator between the digits of any literal number. You > can use this to break up long numbers into more readable > forms. > > There aren't any rules to it; you can use it however > you like: The rule is that the underscore must appear between "digits", so there is at least one rule. :-) > Operation Result > ---------- ------ > Inf + $X Inf > Inf + Inf Inf > > Inf - $X Inf > Inf - Inf NaN I'd expect 0. > Inf * $N Inf ^^^ presumably you meant -Inf here > Inf * 0 NaN I'd expect 0 > $N ** Inf NaN I'd expect Inf > =section * Caveats when using BigNum/BigRats > > All literal numbers are interepreted at compile-time, > before there is any information available about the type > of the variable that will store them. Hmm. In your example, > my BigInt $i = 777_666_555_444_333_222_111; perl has already read the text "BigInt" by the time it's gotten to the number, so it has some idea of what type of thing the numeric literal should be. Besides, what I think should happen is that perl should auto-adjust the type as it reads so that these are equivalent: my BigInt $i = 777_666_555_444_333_222_111; my $i = 777_666_555_444_333_222_111; That's dwimmery-do! -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]