Why can't I divide a fixnum by another fixnum?
division, fixnum, math, ruby
Solution
Because that's how Ruby works: when you divide integer to integer, you get an integer. In this case that'll be 0, because it's the integer part of the result.
To get the float result, just tell Ruby that you actually need a float! There're many ways to do it, I guess the most simple would be just convert one of the operand to Float...
puts counts["email"]/total.to_f
Problem
I'm currently trying to divide `counts["email"]` a hash containing the number 82,000 by a variable `total` which contains the value 1.3 million. When I run `puts counts["email"]/total` I get 0. Why can't I perform division on these?