Check if a number entered by the user with gets.chomp is a float in ruby : <p>I have looked for this a long time now and can't find a satisfactory answer. 
I wold like to know how can I check if the number entered by the user is a float. If is a float it is supposed to be an invalid number.</p>

<p>I have something but the result is always true/Integer</p>

<p>Here is what I have so far.</p>

<pre><code>puts "What are the first number you want to divide"
number1 = gets.chomp.to_i
puts "What is the second number?"
number2 = gets.chomp.to_i

def is_float(variable)
return variable % 1 == 0
end

if (number1 == 0) &amp;&amp; (number2 == 0)
puts "Invalid input"
elsif (is_float(number1) == false) || (is_float(number2) == false)
puts "Invalid input"

else
def divide(number1, number2)
    return number1 / number2
end

    division_result = divide(number1, number2)

def reminder(number1, number2)
    return number1 % number2
end

reminder_results = reminder(number1, number2)
puts ""
puts "Your result is #{division_result}"
puts "Your reminder is #{reminder_results}"
end
</code></pre>
