Exception: Flt::Num::InvalidOperation

Inherits:
Exception show all
Defined in:
lib/flt/num.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

ConversionSyntax

Instance Attribute Summary

Attributes inherited from Exception

#context

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context = nil, *args) ⇒ InvalidOperation

Returns a new instance of InvalidOperation.



222
223
224
225
# File 'lib/flt/num.rb', line 222

def initialize(context=nil, *args)
  @value = args.first if args.size>0
  super context
end

Class Method Details

.handle(context, *args) ⇒ Object



214
215
216
217
218
219
220
221
# File 'lib/flt/num.rb', line 214

def self.handle(context, *args)
  if args.size>0
    sign, coeff, exp = args.first.split
    context.num_class.new([sign, coeff, :nan])._fix_nan(context)
  else
    context.num_class.nan
  end
end