Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 464 Bytes

incorrect_division_method.md

File metadata and controls

25 lines (21 loc) · 464 Bytes

Description

This method, which is supposed to return the result of dividing its first argument by its second, isn't always returning correct values. Fix it.

def divide_numbers x, y
  x / y
end

My Solution

def divide_numbers(x, y)
  x / y.to_f
end

Better/Alternative solution from Codewars

def divide_numbers x, y
  x.fdiv y
end