Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#cmathObject

mathn

mathn serves to make mathematical operations more precise in Ruby and to integrate other mathematical standard libraries.

Without mathn:

using Math::N
3 / 2 => 1 # Integer

With mathn:

using Math::N
3 / 2 => 3/2 # Rational

mathn keeps value in exact terms.

Without mathn:

20 / 9 * 3 * 14 / 7 * 3 / 2 # => 18

With mathn:

using Math::N
20 / 9 * 3 * 14 / 7 * 3 / 2 # => 20

When you require ‘mathn’, the libraries for CMath is also loaded.

Author: Keiju ISHITSUKA (SHL Japan Inc.)



37
# File 'lib/mathn.rb', line 37

require "cmath"