develooper Front page | perl.perl5.porters | Postings from July 2001

Math-BigInt v1.36 out

Thread Next
July 9, 2001 13:21
Math-BigInt v1.36 out
Message ID:

Moin [grumble need to retype msg since disc was full...],

first some important info: is still down, I can not read my
mail there. So please use for now. It will vanish at
the end of July, but is more reliable. Sorry for any inconvienence this
may have caused.

The new version is out (along with new versions of Math::Big, Math::String
and the still shiny Math::BigInt::BitVect). Enjoy!

There were some minor (but still important changes) and one major change.
Please read carefully. First the minor ones:

  Various small fixes and error corrections in code, tests, comments and
  docs. Especially the added is_positive(), is_negative() and the
  improvemed handling of +inf and -inf comes to mind.
  The ACCURACY file was incorporated into the pod, so that the Perl core
  also gets the documentation.
  Fixed the long standing bug in fdiv(), that caused the rewritten fsqrt()
  to fail for most of it's arguments. The problem existed in all rewritten
  versions of and appeared when the length of $y was (much)
  greater than the length of $x:

        use Math::BigFloat;

        print 2 /

  would output '0.079' instead of '0.07992009269196...'.
  bmul() is now faster in nearly every case due to internal optimization. It
  is also _much_ faster when the second argument contains lot's of decimal
  zeros; when it contains nearly only zeros mul goes from O(N*N) to O(N).

Now the major one:

  All the ugly perl-math code was ripped^Wtorn out^W^Wcarefully removed from
  Math::BigInt and stuffed^Wthrown^Wplaced into Math::BigInt::Calc. While
  no changes on the outside are apparent (as so often it is the case with
  foul^Wrotten cores^Wmessy systems), this allows you to use another
  library to do the magic^Wmath. Oh, I think my Ctrl-W key just broke...

  You can use another lib like Math::BigInt::BitVect by this:

        use Math::BigInt lib => 'BitVect';

        $x = Math::BigInt->new(2);
        $u = $x ** 100_000;

  On a 850 Mhz Athlon the "lib => 'BitVect'" part makes the difference
  between 35 and 0.05 seconds. ;) Yes, I know this particulary benchmark is
  unfair on the perl code, but who said I am fair? ;o)

  If anyone want's to port his/her pet math lib to the new MBI interface,
  just ask for help. It really _is_ easier now than ever!

What I did not address was BS2000 (I am still trying to lay hands on such a
system to find the actual failures) and Os390/UTS (because the problems with
these systems is not BigInt, but rather either Perl or the Bigint testsuite.
And I do not feel like sweeping failures under the carpet today ;)

Thanx for listening,


PS: Jarkko: You will need the following files:


I also produced a patch and I can upload it somewhere, but it is 41 kB
gziped (and my first attempt and a multi-file patch). Also, there may be
problems due to the tests for Bigint beeing under lib/Math/BigInt/t since
Math/BigInt/ is also there!?

- --
perl -MMath::String -e 'print \
Math::String->from_number("215960156869840440586892398248"),"\n"'     Thief - The Dark Project       My current Perl projects       Fight for your right to link.
 PGP key available on or via email.

Version: 2.6.3i
Charset: latin1


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About