ruby float 2 decimals code example Example: ruby division floating decimal 9.to_f / 5 #=> 1.8 9 / 5.to_f #=> 1.8