Module: Trxl::MultitiveOp1

Defined in:
lib/trxl/trxl_grammar.rb

Instance Method Summary collapse

Instance Method Details

#apply(a, b) ⇒ Object



3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
# File 'lib/trxl/trxl_grammar.rb', line 3474

def apply(a, b)
  begin
    result = super
    if result.respond_to?(:nan?) && result.nan?
      raise Trxl::DivisionByZeroError, "Division by zero: '#{a} % #{b}'"
    end
    result
  rescue ZeroDivisionError
    raise Trxl::DivisionByZeroError, "Division by zero: '#{a} % #{b}'"
  end
end