Thank you Pawan for the Links. They solved my problem.
I am new to both Linux and Perl. As far as I can make out, whereas BigInt is transparent in Perl, BigFloat is not--at least not yet. A scalar variable has to be changed explicitly to a BigFlaot variable before it can be used as such. The following code gives the division of 1/3 as 500 3s to the right of the decimal point (please note this is a beginner's program):
-
#!/usr/bin/perl5.8.8 -w #path to perl in my system
-
#gives division $nom/$denom (1/3) to $prec (500) precise digits
-
#to the right of the decimal point.
-
use strict;
-
-
use Math::BigInt;
-
use Math::BigFloat;
-
my $nom = 1;
-
my $denom = 3;
-
my $x = Math::BigFloat->new($nom); # scalar $nom -> BigFloat $x.
-
my $prec = -500;
-
Math::BigFloat->precision($prec); # sets precision
-
my $value = $x->copy()->bdiv($denom); # BigFloat division $x/$denom
-
print $value,"\n";
-
Problem solved, thank you!
zakad