On Tuesday 21 September 2010 12:34:18 John W. Krahn wrote:
> Abu Yoav wrote:
> > Hi,
> > --- c output ---
> > d1 = 6.892964e-309
> > d2 = 1.102874e-307
> > sum = 1.171804e-307
> > 
> > --- perl output ---
> > d1 = 0.000000e+00
> > d2 = 1.000000e-307
> > sum = 1.000000e-307
> 
> $ perl -le'
> my $d1 = 6.892964e-309;
> my $d2 = 1.102874e-307;
> 
> my $sum = $d1 + $d2;
> 
> printf "d1 = %e\n", $d1;
> printf "d2 = %e\n", $d2;
> printf "sum = %e\n", $sum;
> '
> d1 = 6.892964e-309
> d2 = 1.102874e-307
> sum = 1.171804e-307
> 
> 

With this program:

[code]
#!/usr/bin/perl

use strict;
use warnings;

my $d1 = 6.892964e-309;
my $d2 = 1.102874e-307;

my $sum = $d1 + $d2;

printf "d1 = %e\n", $d1;
printf "d2 = %e\n", $d2;
printf "sum = %e\n", $sum;
[/code]

I'm getting:

[outout]
d1 = 0.000000e+00
d2 = 1.000000e-307
sum = 1.000000e-307
[/output]

On Mandriva Linux Cooker on an x86 (with perl-5.12.2-4mdv2011.0 ) and Mandriva 
Linux 2010.1 on an x86-64 (perl-5.10.1-10mdv2010.1).

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Best Introductory Programming Language - http://shlom.in/intro-lang

<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to