Class: Eqn::Function::RoundBase
- Defined in:
- lib/eqn/function.rb
Overview
Base node class for round functions.
Instance Method Summary collapse
Methods inherited from EqnNode
Instance Method Details
#value(vars) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/eqn/function.rb', line 16 def value(vars) value = elements.shift.value(vars) raise ZeroDivisionError if value.is_a?(Float) && (value.abs == Float::INFINITY || value.nan?) if term? value.send(self.class::ROUND_METHOD) else round_to_precision(vars, value) end end |