offtopic? Math::BigFloat

C. Abney cabney at ucsd.edu
Mon Dec 23 15:40:01 CST 2002


~sdpm~
On Mon, 2002-12-23 at 13:09, C. Abney wrote:

> =8<======
>         if ( 0 > $X->bcmp(1) ) {
>                 my $N = $X->copy();
>                 $N->bone();
>                 $N->bdiv($X);
>                 return -Ln($N, $P);
>         }
>         $X->bfround( -$modP );
> =8<======
> 
> This was necessary because the existing code was rounding my really
> small number to zero  But it wasn't doing it /explicitly/, rather as a
> consequence of assuming it was a normal sized number, and doing a normal
> division on it.  Also, $X->bfround( -$modP ) is evaluated twice if $X <
> 1 in the original code.  There's probably a more efficient way to

Well, duh!

	$X->bpow(-1);

Haven't tried it, though.  heheh.
 
-- 
Charles Abney
Polymorphism Research Laboratory, 0603
UCSD School of Medicine
9500 Gilman Dr.
La Jolla, CA 92093-0603
~sdpm~

The posting address is: san-diego-pm-list at hfb.pm.org

List requests should be sent to: majordomo at hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.




More information about the San-Diego-pm mailing list