Exception: Decimal::DivisionByZero

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

Overview

Division by zero exception.

The result of the operation is +/-Infinity, where the sign is the product of the signs of the operands for divide, or 1 for an odd power of -0.

Instance Attribute Summary

Attributes inherited from Exception

#context

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context = nil, sign = nil, *args) ⇒ DivisionByZero

Returns a new instance of DivisionByZero.



124
125
126
127
# File 'lib/decimal/decimal.rb', line 124

def initialize(context=nil, sign=nil, *args)
  @sign = sign
  super context
end

Class Method Details

.handle(context, sign, *args) ⇒ Object



121
122
123
# File 'lib/decimal/decimal.rb', line 121

def self.handle(context,sign,*args)
  Decimal.infinity(sign)
end