There's the method to_f
for the purpose:
1.to_f # => 1.0
1.to_f.class # => Float
In your example:
failure_and_run_count[:failure] / failure_and_run_count[:run].to_f * 100.0
Only one operand needs to be explicitly coerced to Float
since the other is automatically coerced when you call the /
method.
Pay attention because nasty things could happen:
''.to_f # => 0.0
nil.to_f # => 0.0
'foo'.to_f # => 0.0