Module: Rbsiev::Primitives::Arithmetic

Included in:
Rbsiev::Primitives
Defined in:
lib/rbsiev/primitives/arithmetic.rb

Instance Method Summary collapse

Instance Method Details

#add(*args) ⇒ Object



17
18
19
# File 'lib/rbsiev/primitives/arithmetic.rb', line 17

def add(*args)
  a_calc(:+, *args)
end

#div(*args) ⇒ Object



29
30
31
# File 'lib/rbsiev/primitives/arithmetic.rb', line 29

def div(*args)
  a_calc(:/, *args)
end

#mod(*args) ⇒ Object



33
34
35
# File 'lib/rbsiev/primitives/arithmetic.rb', line 33

def mod(*args)
  a_calc(:%, *args)
end

#mul(*args) ⇒ Object



25
26
27
# File 'lib/rbsiev/primitives/arithmetic.rb', line 25

def mul(*args)
  a_calc(:*, *args)
end

#subtract(*args) ⇒ Object



21
22
23
# File 'lib/rbsiev/primitives/arithmetic.rb', line 21

def subtract(*args)
  a_calc(:-, *args)
end

#zero?(obj) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/rbsiev/primitives/arithmetic.rb', line 9

def zero?(obj)
  if number?(obj) == SCM_TRUE
    same_value?(obj, 0)
  else
    SCM_FALSE
  end
end