Actions
Bug #4510
closedFloat#round(n) is O(n)
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]
Backport:
Description
=begin
The current implementation of Float#round(n) is O(n). This causes a minor issue with rubyspec, which includes this:
0.8346268.round(-2.0**30).should == 0
which would take about 5 minutes to complete on my machine, during which time the interpreter is locked, doesn't respond to signals, and certainly won't brook any Timeout interruption.
Attached is a patch to replace the problematic part with a call to pow(3).
=end
Files
Updated by naruse (Yui NARUSE) about 13 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r31146.
Alex, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Actions
Like0
Like0