Permalink
Browse files

Initial commit of Math::BigRat 0.22

  • Loading branch information...
0 parents commit 272116273b0c86a7e366dccc1073f67b4327a556 @leto committed Jul 7, 2009
Showing with 7,399 additions and 0 deletions.
  1. +10 −0 BUGS
  2. +206 −0 CHANGES
  3. +17 −0 INSTALL
  4. +4 −0 LICENSE
  5. +35 −0 MANIFEST
  6. +9 −0 MANIFEST.SKIP
  7. +22 −0 META.yml
  8. +28 −0 Makefile.PL
  9. +20 −0 README
  10. +61 −0 SIGNATURE
  11. +13 −0 TODO
  12. +343 −0 inc/Module/Install.pm
  13. +70 −0 inc/Module/Install/Base.pm
  14. +82 −0 inc/Module/Install/Can.pm
  15. +93 −0 inc/Module/Install/Fetch.pm
  16. +245 −0 inc/Module/Install/Makefile.pm
  17. +371 −0 inc/Module/Install/Metadata.pm
  18. +64 −0 inc/Module/Install/Win32.pm
  19. +40 −0 inc/Module/Install/WriteAll.pm
  20. +2,017 −0 lib/Math/BigRat.pm
  21. +122 −0 t/Math/BigRat/Test.pm
  22. +103 −0 t/big_ap.t
  23. +1,673 −0 t/bigfltpm.inc
  24. +41 −0 t/bigfltrt.t
  25. +99 −0 t/biglog.t
  26. +331 −0 t/bigrat.t
  27. +925 −0 t/bigratpm.inc
  28. +38 −0 t/bigratpm.t
  29. +40 −0 t/bigratup.t
  30. +68 −0 t/bigroot.t
  31. +27 −0 t/hang.t
  32. +26 −0 t/pod.t
  33. +29 −0 t/pod_cov.t
  34. +41 −0 t/requirer.t
  35. +86 −0 t/trap.t
10 BUGS
@@ -0,0 +1,10 @@
+
+Known bugs:
+
+* BigRat does not handle modify() yet or in a very incomplete manner
+* There are probably many... rats.
+
+Please send me test-reports, your experiences with this and your ideas - I love
+to hear about my work!
+
+Tels <http://bloodgate.com/>
206 CHANGES
@@ -0,0 +1,206 @@
+
+2008-04-06 v0.22 Tels 973 tests
+ * fix bug ##34584: hang when calling exp (Thanx Steve Wills!)
+ + broot() normalizes result
+ + bexp() works for values like '1/2' (sqrt), '1/4' (broot), etc.
+ + broot() works for values like '2/3'
+ * added as_float() - return the BigRat as rounded Math::BigFloat
+
+2007-09-16 v0.21 Tels 956 tests
+ * require Math::BigInt v1.88
+ * fix as_number() with Nan/inf (thanx zefram!)
+ * add POD stub for objectify() to make pod_cov.t happy
+
+2007-06-30 v0.20 Tels 956 tests
+ * require Math::BigInt v1.87
+ * add bnok() and bexp()
+
+2007-04-17 v0.19 Tels 934 tests
+ * fix the check in bnorm() as it breaks under Pari
+ * require Math::BigInt v1.83
+ * exponent() makes a copy, so we can skip copy()
+ * fix the licence back to be "perl"
+
+2007-04-09 v0.18 Tels 934 tests
+ * install_as_core() to work around Module::Install bug
+ * remove PREREQ_FATAL since the toolchain is broken
+ * require Math::BigInt v1.82
+
+2007-02-03 v0.17 Tels 934 tests
+ * include the spelling fixes for bleadperl
+ * more typo and POD fixes
+ * include from_bin(), from_hex() and from_oct()
+ * add tests for octal and from_hex()/from_bin()
+ * bundle and use Module::Install
+
+Older revision history:
+
+2001-11-21 v0.01 Tels
+ * first release
+2002-02-24 v0.02 Tels (late night)
+ * ripped out doc and replaced by something closer to the truth
+ * subclass of BigFloat w/ overload section
+ * uses d/n instead of x/y for denominator and nominator
+ * tests from Math::BigFloat with a test subclass warping the input/output
+ * added preliminary bmul(), badd(), bdiv() methods
+ * added binf(), bone(), bzero() and bnan()
+ * added _bzero(), _bone(), _bnan() and _binf() (bnan() etc inherited)
+ * dummy blog(), bceil(), floor(), bfac() and bpow() functions
+ * parse input as '0.1', '0.1/0.1', '1/10', '10' or '10/0.1'
+ * input as Math::BigInts or Math::BigFloats is okay
+2002-02-25 v0.03 Tels (early morning hours)
+ * fixed bstr()/bsstr() for negative output and inf/NaN
+ * _d/_n were accidentily swapped
+ * added numerator()/denominator()/parts() and doc and tests
+ * fixed is_one()
+ * '1/ ' is as invalid as '1/'
+ * badd/bsub/bmul: inf/NaN handling was wrong due to copy&paste (ha!) from bdiv
+ * more extensive testsuite (about 400 tests)
+ * bnorm() normalizes 0/x to 0/1
+ * badd()/bsub()/bmul()/bdiv() handle +/-/NaN/inf/-inf sign properly
+ * t/Math/BigRat/Test.pm: fixed bstr() and bsstr() to handle inf/NaN and signs
+2002-03-19 v0.04 Tels
+ * bcmp/bacmp/as_number/bfloor/bceil work now
+ * bsqrt() is better now
+ * t/Math/BigInt/Test.pm is fixed now and makes a much better figure
+ (formerly almost all of the 1500 tests in bigfltrt.inc would fail. Now we
+ fail "only" 868 of 2014 tests, and most of them since the test dies early.
+ * added stubs for round, bfround, bround and certain others
+2002-03-19 v0.04 Tels
+ * 5/7+3/7 hung under "Math::BigInt upgrade =>" (forgot local upgrade = undef)
+ * better testsuite
+ * added & fixed isa()
+ * new() can handle Lite
+2002-03-26 v0.05 Tels
+ * various bugfixes
+ (local undef upgrade, Bigint handling, handling of string arguments)
+ * fixed up isa()
+ * removed some old and wrong comments
+2002-05-23 v0.06 Tels
+ * added import() routine
+ * support for 'use Math::BigRat with => Foo::Bar;'
+ * support for 'use Math::BigRat lib => Foo::Bar;'
+ * bnorm() makes sure that both parts (n and d) are of class $MBI
+ * more documentation
+ * bugfix in new() with two arguments
+ * INSTALLDIRS => perl
+2002-06-04 v0.07 Tels
+ * bfac() now works for integers (x/1), and returns $x->bnan() instead of
+ Math::BigRat->bnan() (modify in-place)
+ * bpow() faster for x/1 ** y/1 and x/z ** y/1 cases (some of the speedups are
+ two-digit factors :) - also some bugfixes
+ * bpow() no longer litters stdout
+ * removed some (all of them commented out) debug prints to reduce footprint
+ * shortened testfile bigrat.t
+ * some hardcoded 'Math::BigInt' replaced with '$MBI'
+ * bceil() would leave -0 in some cases
+ * (more) tests (all in all 628) for:
+ bceil/bfloor/bpow/bfac/parts/denominator/nominator/binc/bdec
+ * parts('-3/1') would return (3,1) instead of (-3,1)
+ * parts() did not work for NaN, +inf, -inf
+ * numerator()/denominator() did not work for inf,-inf,NaN
+ * new('1.2.2') was valid (resulted in 12/10 due to bug in BigFloat)
+ * new() for some cases left internal state not as 0/0 for NaN, inf, -inf etc
+ * binc()/bdec() were missing entirely
+2002-08-13 v0.08 Tels
+ * bsstr() returned positive result for negative numbers - Oups!
+ * added a numify() so that $array[Math::BigRat->new('17/8')] works
+2002-08-14 v0.09 Tels
+ * documentation was lacking a proper description, METHODS missing etc
+ * setting accuracy/precision in BigFloat/BigInt interfered with BigRat
+ * new testcases for the A/P fix in t/big_ap.t
+ * speedup: apply the same trick to avoid calls to objectify() like in BigInt
+ * speedup: badd()/bsub() did needless gcd(), copy() and bdiv()
+ * speedup: workaround for 'x.y.z'-valid bug in BigFloat no longer neccessary
+2002-12-15 v0.10a Tels 700 tests (not released)
+ * as_number() forgot to disable $upgrade, resulting in BigRat again when
+ run under -Mbigrat -- thanx to Ian Phillips.
+ * fixed a bug in new() that failed with
+ Math::BigRat->new(Math::BigInt::Lite->new(123));
+ * fixed new() to work better under
+ use Math::BigRat with => 'Math::BigInt::Lite';
+ * add a test for "require Math::BigRat; $x = Math::BigRat->new(123); $x++;"
+ (it already works since we "use Math::BigFloat;"
+ * require Carp; Carp::croak () instead of simple die()
+ * implemented bmod() - Thanx Ian Phillips.
+ * bsqrt() now returns a big rationale - Ian again
+ * tests for bmod(), as_number(), bsqrt() and some NaN cases
+ * bfloor()/bceil() broke under use bigrat; due to missing upgrade-disabling
+2002-12-18 v0.10b Tels 729 tests (not released)
+ * support for :trap_nan/:trap_inf
+ * doc for config()
+ * implement trapping of creation of NaN/inf/-inf
+2003-07-06 v0.10 Tels 751 tests (released on 2003-08-13)
+ * one more die => croak conversion
+ * fix inf/NAN handling in new()
+ * fix bsqrt(3/4) and similiar cases failing with some obscure error, this was
+ a simple typo ({_n} vs. {_m}). Added tests for that.
+ * numify() is now much faster (38400 vs 720 tries/s on 2Ghz AMD XP2400+)
+2004-01-07 v0.11 Tels 859 tests
+ * require Exporter vs. use it
+ * more tests for bacmp(), bnorm()
+ * fixed bug in bacmp() with ($x,[+-]inf) (Thanx to William T. Morgan!)
+ * fixed bug in new("+-inf/X") (e.g. "-inf/5" resulted in "inf", not "-inf")
+ * delete _a and _p on _d and _n, reduces size of a BigRat object from
+ 887 bytes to 767 bytes on a x86 32 bit system. This also makes some
+ operations slightly (single-digit percentages) faster.
+ * bacmp() is about 20% faster
+ * bcmp() is:
+ * about 4 times faster if sign($x) != sign($y)
+ * about 20% faster if sign($x) == sign($y)
+ * added broot(), bmodinv(), bmodpow(), blog() so that their equivalent of:
+ # perl -MMath::BigRat=:constant -le '$a = 2.0 ** 32; print $a->broot(4)'
+ Can't call method "copy" on an undefined value at BigFloat.pm line 1442.
+ works now for integer arguments and inf/NaN, at least.
+ * doc: rationales => rational numbers
+2004-02-15 v0.12 Tels 863 tests
+ * fixed bug in is_one() (segfault under v.5.6.x)
+ * implemented length() and digit() for integers
+ * beefed up testing class Test.pm to make more float tests work (185 of them
+ still fail)
+ * added AUTOLOAD to load fxxx() stubs (for BigFloat compatibility tests)
+ * $IMPORT for require and AUTOLOAD
+ * added as_bin(), as_hex() which work for integers, NaN, and +-inf
+ * implement broot() and blog() for non-integer numbers
+ * fixed blsft()/brsft() to work with undefined or scalar base
+ * added a copy() method to be independend from BigInt's copy()
+ * adopted to new internal format of Math::BigFloat v1.44 (from BigInt v1.70)
+2004-10-22 v0.13 Tels 892 tests
+ * fixed digit(): it never worked due to dropping the second parameter
+ * fixed a bug in brsft() when passing arguments (2 vs. 3 in objectify)
+ * use Math::BigInt->config('lib') for parts instead of Math::BigInt
+ + This makes everything go about 2..4 times faster :)
+ + And it saves memory (408 vs. 807 bytes for a simple number)
+ * _as_float() is about 6 times as fast for integers (e.g. 123/1 vs. 2/3)
+ * denominator() returns 1 for +inf and -inf (+inf/1, -inf/1) instead of +-inf
+ * when using "lib => GMP;", certain things never worked:
+ + sqrt() was not possible
+ + new("2.3") did not work
+ + new("12.3e-2") did not work
+2005-01-01 v0.14 Tels 924 tests
+ * require Math::BigInt v1.74
+ * streamline copy()
+ * inline is_zero() into bneg(), making it about 50% faster
+ * more tests for bneg()
+ * register callback to get notified of lib changes from Math::BigInt
+ * much simpler import() logic
+ * new() accepts input like new(Math::BigInt->new(123),Math::BigInt->new(7));
+ * doc: as_hex(), as_bin(), add note about as_pos(), as_neg() and as_int()
+ * numify() now deals with large N and D by using BigFloat (Thanx Hugo!)
+ * numify() lost the sign on negative integer values (Thanx Zefram!)
+2005-04-02 v0.15 Tels 924 tests
+ * no need to require Exporter
+ * rem no longer used 'with' from import
+ * add a few comments here and there
+ * fix import()'s handling of the lib argument (it didn't work)
+ * fix segfault under trap_nan in _bnan()
+ * remove unused IMPORT logic (require BigRat seems to work without it)
+2007-01-28 v0.16 Tels 926 tests
+ * require Math::BigInt 1.78
+ * add support for 'try' and 'only'
+ * add pod tests
+
+Please send me test-reports, your experiences with this and your ideas - I love
+to hear about my work!
+
+Tels <http://bloodgate.com/>
17 INSTALL
@@ -0,0 +1,17 @@
+Math::BigRat - arbitrarily big rational numbers
+
+(C) ..--- ----- ----- .---- - ..--- - . .-.. ... .-.-.- All rights reserved.
+
+Requires new version of Math::BigInt and Math::BigFloat as found on CPAN.
+
+To test, unzip & untar package, then run
+
+ perl Makefile.PL
+ make
+ make test
+ make install # as root
+
+Please send me test-reports, your experiences with this and your ideas - I love
+to hear about my work!
+
+Tels <http://bloodgate.com/>
@@ -0,0 +1,4 @@
+This program is free software; you may redistribute it and/or modify it
+under the same terms as Perl itself.
+
+Tels <http://bloodgate.com/>
@@ -0,0 +1,35 @@
+BUGS
+CHANGES
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+INSTALL
+lib/Math/BigRat.pm
+LICENSE
+Makefile.PL
+MANIFEST
+MANIFEST.SKIP
+META.yml # Module meta-data (added by MakeMaker)
+README
+SIGNATURE
+t/big_ap.t # do Big(Float|Int)'s A/P interfere w/ Rat?
+t/bigfltpm.inc # BigFloat's testsuite
+t/bigfltrt.t # run BigRat through BigFloat's testsuite
+t/biglog.t
+t/bigrat.t # test big rationales like 7/5
+t/bigratpm.inc # actual BigRat tests
+t/bigratpm.t # native BigRat testsuite
+t/bigratup.t # test under $Math::BigInt::upgrade
+t/bigroot.t
+t/hang.t
+t/Math/BigRat/Test.pm # test class for BigFloat compatible output
+t/pod.t # test that the POD is wellformed
+t/pod_cov.t # test that the POD covers all public functions
+t/requirer.t # see if require works properly
+t/trap.t # see if trap_nan and trap_inf work
+TODO
@@ -0,0 +1,9 @@
+.*\.tar\.gz
+^blib.*
+^\w+\.(html|txt|png|dot|pl|svg|old|bak|org)
+^Makefile\z
+^Makefile.(old|bak)\z
+^MANIFEST.(old|bak)\z
+pm_to_blib
+^Math-BigRat-
+^todos[\\\/]
@@ -0,0 +1,22 @@
+---
+abstract: Arbitrary big rational numbers
+author:
+ - 'Tels <nospam-abuse@bloodgate.com>'
+build_requires:
+ Test::More: 0.47
+distribution_type: module
+generated_by: Module::Install version 0.68
+installdirs: perl
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
+name: Math-BigRat
+no_index:
+ directory:
+ - inc
+ - t
+requires:
+ Math::BigInt: 1.88
+ perl: 5.6.0
+version: 0.21
@@ -0,0 +1,28 @@
+
+# We need at least Perl 5.6
+require 5.006;
+use strict;
+
+# Load the Module::Install bundled in ./inc/
+use inc::Module::Install;
+
+# The name of your distribution
+name 'Math-BigRat';
+
+# Get most of the details from the primary module
+all_from 'lib/Math/BigRat.pm';
+
+requires 'perl' => "5.006";
+requires 'Math::BigInt' => 1.88;
+
+build_requires 'Test::More' => 0.47;
+
+license 'perl';
+
+author 'Tels <nospam-abuse@bloodgate.com>';
+
+# install this over the version in the Perl core
+install_as_core;
+
+# Generate the Makefile
+WriteAll;
20 README
@@ -0,0 +1,20 @@
+Math::BigRat - arbitrarily big rational numbers
+
+(C) ..--- ----- ----- .---- - ..--- - . .-.. ... .-.-.- All rights reserved.
+
+This package is a subclass of Math::BigFloat. You need the rewritten version
+of Math::BigInt and Math::BigFloat for it to work.
+
+To test, unzip & untar package, then run
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+See INSTALL for detailed help on installing these modules.
+
+Please send me test-reports, your experiences with this and your ideas - I love
+to hear about my work!
+
+Tels <http://bloodgate.com/>
Oops, something went wrong.

0 comments on commit 2721162

Please sign in to comment.