aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mathn.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 00:26:27 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 00:26:27 +0000
commit5dcb4fc18b38591d111e8c71667e65021b51cbdd (patch)
treefe362e4732f2f7633c047ef0a620d1b2fe164f7d /lib/mathn.rb
parentb6dd727b86a9107dfb6f00164151fc59d50e8605 (diff)
downloadruby-5dcb4fc18b38591d111e8c71667e65021b51cbdd.tar.gz
* lib/mathn.rb: Improve documentation and attach it to Numeric.
Modified from patch by Anil V. [Ruby 1.9 - Bug #4762] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mathn.rb')
-rw-r--r--lib/mathn.rb44
1 files changed, 23 insertions, 21 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb
index 05840924d9..fa4576f1c1 100644
--- a/lib/mathn.rb
+++ b/lib/mathn.rb
@@ -1,42 +1,44 @@
+#--
+# $Release Version: 0.5 $
+# $Revision: 1.1.1.1.4.1 $
+
##
# = mathn
#
-# mathn is a library for changing the way Ruby does math. If you need
+# mathn is a library for changing the way Ruby does math. If you need
# more precise rounding with multiple division or exponentiation
-# operations, then mathn is the right tool. It makes sense to use this
-# library if you can use it's late rounding. Mathn does not convert
-# Fixnums into Floats as long as you do not convert it yourself.
-# Instead of using Float as intermediate value it use Rational as
-# value representation.
+# operations, then mathn is the right tool.
#
-# Example Fixnum with intermediate Float:
+# Without mathn:
#
-# 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 18
+# 3 / 2 => 1 # Integer
#
-# Example: using mathn Fixnum/Rational:
+# With mathn:
#
-# require 'mathn'
-# 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 20
+# 3 / 2 => 3/2 # Rational
#
-# == Usage
+# mathn features late rounding and lacks truncation of intermediate results:
#
-# To start using this library, simply:
+# Without mathn:
#
-# require "mathn"
+# 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 18
#
-# This will change the way division works for Fixnums, specifically
+# With mathn:
#
-# 3 / 2
+# 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 20
#
-# will return +Rational+ (3/2) instead of the usual +Fixnum+ 1.
#
-# == Copyright
+# When you require 'mathn' the libraries for Prime, CMath, Matrix and Vector
+# are also loaded.
#
-# Author: Keiju ISHITSUKA(SHL Japan Inc.)
+# == Copyright
#
+# Author: Keiju ISHITSUKA (SHL Japan Inc.)
#--
-# $Release Version: 0.5 $
-# $Revision: 1.1.1.1.4.1 $
+# class Numeric follows to make this documentation findable in a reasonable
+# location
+
+class Numeric; end
require "cmath.rb"
require "matrix.rb"