From: Gavin Sinclair Date: 2002-12-27T15:19:22+09:00 Subject: Re: 1210 / 100 = 12? what? Hello Tom, On Friday, December 27, 2002, 4:59:59 PM, you wrote: > can someone explain this to me: > puts "#{1210 / 100}" --> 12 > why isn't the answer 12.1? > i was getting ticked at javascript for producing poor arithmetic results but > this is nuts! > -transami I'm surprised you don't know this, Tom. In Ruby, and several other languages, the division of two integers results in an integer. To get a floating-point answer, use puts "#{1210.0 / 100} --> 12.1 (You could use 100.0 as well/instead.) Cheers, Gavin [who just added this to the FAQ]