Exception: Decimal::InvalidOperation
- Defined in:
- lib/decimal/decimal.rb
Overview
Invalid operation exception.
The result of the operation is a quiet positive NaN, except when the cause is a signaling NaN, in which case the result is also a quiet NaN, but with the original sign, and an optional diagnostic information.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Exception
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context = nil, *args) ⇒ InvalidOperation
constructor
A new instance of InvalidOperation.
Constructor Details
#initialize(context = nil, *args) ⇒ InvalidOperation
Returns a new instance of InvalidOperation.
110 111 112 113 |
# File 'lib/decimal/decimal.rb', line 110 def initialize(context=nil, *args) @value = args.first if args.size>0 super end |
Class Method Details
.handle(context = nil, *args) ⇒ Object
102 103 104 105 106 107 108 109 |
# File 'lib/decimal/decimal.rb', line 102 def self.handle(context=nil, *args) if args.size>0 sign, coeff, exp = args.first.split Decimal.new([sign, coeff, :nan])._fix_nan(context) else Decimal.nan end end |