From: Diogo Almeida Date: 2010-07-13T21:09:04+09:00 Subject: Ruby 1.9.2 float precision Hello, The Liquid templating engine has the following tests passing till ruby 1.9.2 rc1: assert_template_result "4.66666666666667", "{{ 14 | divided_by:'3.0' }}" #equals to 14/3.0 in irb assert_template_result "6.3", "{{ '2.1' | times:3 }}" #equals to 2.1*3 in irb However, as far as I could understand, the float precision has been changed with RC1 and the first assertion now returns 15 decimal digits instead of 14: ruby-1.9.2-rc1 > 14/3.0 => 4.666666666666667 And the second returns the same 15 decimal digits instead of 1: ruby-1.9.2-rc1 > 2.1*3 => 6.300000000000001 Even though I realize that the templating engine should not be messing with the ruby pre-defined precisions, I would like to ask what would be the recommended way to get all ruby versions to behave the same? For instance, I've noticed that in both 1.9.1 and 1.9.2-rc1 the instruction (14/3.0).to_r returns the exact same rational, just differing when using the #to_f Best regards -- Posted via http://www.ruby-forum.com/.