Issue #7245 has been updated by mame (Yusuke Endoh).

Status changed from Open to Rejected

This is the spec.

Float is internally stored in binary representation which cannot represent 1.005 precisely.
So the literal "1.005" becomes an approximate Float object actually less than its mathematical value.

  $ ruby -e 'p (1.005 * 3)'
  3.0149999999999997

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Bug #7245: Float.round result not as expected
https://bugs.ruby-lang.org/issues/7245#change-32010

Author: alexr (Alexander Rusa)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37164) [x86_64-darwin12.2.0]


In my second example below I would expect "1.01" as result.

1.9.3-p286 :001 > 1.05.round(1)
 => 1.1 
1.9.3-p286 :002 > 1.005.round(2)
 => 1.0 
1.9.3-p286 :003 > 1.006.round(2)
 => 1.01 

Is this a bug or am I wrong?


-- 
http://bugs.ruby-lang.org/