From: Jan Hendrickx Date: 2011-12-16T20:51:48+09:00 Subject: Rounding error? Hi there, I'm an absolute beginner in Ruby... Here's my problem: print("Length: ") s = gets() length = s.to_f print("Width: ") s = gets() width = s.to_f surface = length * width puts("Surface = #{length} x #{width} = #{surface}") When running this code, it asks for Length and Width as expected, but when I type the values 4.9 and 5.9 it gives 28.910000000000004 as result. The values 3.9 and 3.9 give 15.20999999999999 as result. What do I need to do to avoid these rounding-errors? -- Posted via http://www.ruby-forum.com/.