Topic: "BigInt ActivePerl" (page 1 of 1)

1
Author Post
CommComm
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Hi all.

I'm using ActivePerl on Windows and need some explanation about Math::BigInt package. If I write for instance :
#!/usr/bin/perl -w
use Math::BigInt;
$ctrl= new Math::BigInt "49";
$ctrl=sqrt($ctrl);

I get a message "Operation `sqrt': no method found, argument in overloaded package Math::BigInt at cr183.pl line 4."
I can add it seems there is not built-in function for sqrt in BigInt. With BigFloat, there is one, and it works fine for me :
$ctrl = new Math::BigFloat $ctrl->fsqrt($scale);

What am I doing wrong with BigInt ?
Thanks for your help.
private message
chrisi
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
For BigInt its the method bsqrt.

$ctrl=$ctrl->bsqrt();

Take a look linkhere
Edited by chrisi on 12.11.2004 18:07:25
private message
CommComm
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Thanks for your reply, Chrisi.
But It seems bsqrt is not available on ActivePerl package ("Can't locate... "). Probably one more reason to switch from Windows to Linux, I know :-(

Any other idea ?
private message
chrisi
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
That's strage
I have tried it in activeperl and for me it works this way
private message
CommComm
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Yes, very strange. I tried some different ways to write it, but none worked.

What I forgot to say is I don't get bsqrt (and a lot of others functions) when I call perldoc Math::BigInt. Here is what I get :

$i->bneg return BINT negation
$i->babs return BINT absolute value
$i->bcmp(BINT) return CODE compare numbers (undef,<0,=0,>0)
$i->badd(BINT) return BINT addition
$i->bsub(BINT) return BINT subtraction
$i->bmul(BINT) return BINT multiplication
$i->bdiv(BINT) return (BINT,BINT) division (quo,rem) just quo if scalar
$i->bmod(BINT) return BINT modulus
$i->bgcd(BINT) return BINT greatest common divisor
$i->bnorm return BINT normalization
$i->blsft(BINT) return BINT left shift
$i->brsft(BINT) return (BINT,BINT) right shift (quo,rem) just quo if scalar
$i->band(BINT) return BINT bit-wise and
$i->bior(BINT) return BINT bit-wise inclusive or
$i->bxor(BINT) return BINT bit-wise exclusive or
$i->bnot return BINT bit-wise not

Also, I removed and reinstalled the package to be sure I got the last one.

I don't understand.

Edit : Oops... I think I have it. I'm not in perl 5.8...
Edited by CommComm on 12.11.2004 21:21:28
private message

Topic: "BigInt ActivePerl" (page 1 of 1)

1