Module: Flt::MathBase
- Included in:
- DecNum::CMath, DecNum::Math, BinNum::CMath, BinNum::Math
- Defined in:
- lib/flt/math.rb
Overview
Base module for Math modules for specific Num classes. Math modules area analogous to ::Math and provide both a means to access math functions (of the current context for a Num class) and, more useful here, a means to access the functions unqualified by including the module in some scope.
The math functions provided by Math modules are trigonometric (sin, cos, tan, asin, acos, atan, hypot), exp, log, log2, and log10.
Example:
DecNum.context(:precision=>5) do
puts DecNum::Math.sqrt(2) # => 1.4142
end
DecNum.context.precision = 10
include DecNum::Math
puts sqrt(2) # => 1.414213562
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
25 26 27 |
# File 'lib/flt/math.rb', line 25 def self.included(base) base.extend ClassMethods end |