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
Actions
Like0
Like0