U
usenet
I'm playing around with the unit conversion methods of
Math::NumberCruncher. It seems to be changing an ordinary scalar
into... something else... that I don't really understand. I am seeking
advice on what is happening to my scalar and which perldoc or other
resource I can use to understand it.
Kindly consider this sample code, which simply attempts to convert a
value from feet->meters and back again:
#!/usr/bin/perl
use strict; use warnings;
use Math::NumberCruncher;
use Data:umper;
my $crunch = Math::NumberCruncher->new();
my $length = 5; #feet
print Dumper $length; #an ordinary scalar
$length = $crunch -> ft2m($length); #convert to meters
print Dumper $length; #not an ordinary scalar
print "$length meters\n"; #...but it looks like one
$length = $crunch -> m2ft($length); #convert back to feet (?)
print "$length feet\n"; #NaN???
__END__
########## OUTPUT ############
$VAR1 = 5;
$VAR1 = bless( {
'_m' => [
1524
],
'_es' => '-',
'_p' => -20,
'_e' => [
3
],
'sign' => '+'
}, 'Math::BigFloat' );
1.52400000000000000000 meters
NaN feet
Math::NumberCruncher. It seems to be changing an ordinary scalar
into... something else... that I don't really understand. I am seeking
advice on what is happening to my scalar and which perldoc or other
resource I can use to understand it.
Kindly consider this sample code, which simply attempts to convert a
value from feet->meters and back again:
#!/usr/bin/perl
use strict; use warnings;
use Math::NumberCruncher;
use Data:umper;
my $crunch = Math::NumberCruncher->new();
my $length = 5; #feet
print Dumper $length; #an ordinary scalar
$length = $crunch -> ft2m($length); #convert to meters
print Dumper $length; #not an ordinary scalar
print "$length meters\n"; #...but it looks like one
$length = $crunch -> m2ft($length); #convert back to feet (?)
print "$length feet\n"; #NaN???
__END__
########## OUTPUT ############
$VAR1 = 5;
$VAR1 = bless( {
'_m' => [
1524
],
'_es' => '-',
'_p' => -20,
'_e' => [
3
],
'sign' => '+'
}, 'Math::BigFloat' );
1.52400000000000000000 meters
NaN feet