On 19/06/2011 14:07, Patrick Dupre wrote:
Hello,

I need to convert the result of an aritmetic operation on 2
bignum into a "normal" float (ie double)

I did not find a way to do this.
no bignum ;
my $res = $A - $B ;

gives me always a bignum ($res) if $A and $B are bignum.

Hey Patrick

I suggest you convert the values to strings, which will force them to be
converted to normal floats before the arithmetic is done.

no bignum ;
my $res = $A->bstr - $B->bstr;

It is also probably better to use Math::BigFloat instead of bignum, so
that you can better control which variables are big floats and which are
normal.

I also wonder why you want to convert big floats into normal ones? The
only reason I can think of is to improve execution speed.

HTH,

Rob

--
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