Exception: Decimal::Inexact

Inherits:
Exception
  • Object
show all
Defined in:
lib/decimal/decimal.rb

Overview

Inexact Exception.

This occurs and signals inexact whenever the result of an operation is not exact (that is, it needed to be rounded and any discarded digits were non-zero), or if an overflow or underflow condition occurs. The result in all cases is unchanged unless the context has exact precision, in which case the result is Nan

Instance Attribute Summary

Attributes inherited from Exception

#context

Class Method Summary collapse

Methods inherited from Exception

#initialize

Constructor Details

This class inherits a constructor from Decimal::Exception

Class Method Details

.handle(context, *args) ⇒ Object



162
163
164
# File 'lib/decimal/decimal.rb', line 162

def self.handle(context, *args)
  Decimal.nan if context.exact?
end