summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/lib/bigdecimal
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-30 07:26:51 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-30 07:26:51 +0000
commitecb6bd90c01edc19165ff526ef15a59693b4f12f (patch)
tree3de11687882262cc3840c1231187c574d9a71b6a /ext/bigdecimal/lib/bigdecimal
parent18805586d9a524f0a351a1affd950e50166ed5e0 (diff)
* ext/bigdecimal/lib/bigdecimal/jacobian.rb (Jacobian#dfdxi):
fix jacobian to get stuck in an infinite loop when a solution is not found due to forget to increment nRetry counter. Patch by alperakgun from github.com/shyouhei/ruby/pull/8 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/lib/bigdecimal')
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
index 8ab836259a..f53e5b1437 100644
--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -53,7 +53,8 @@ module Jacobian
until ok>0 do
s = f.zero
deriv = []
- if(nRetry>100) then
+ nRetry += 1
+ if nRetry > 100
raise "Singular Jacobian matrix. No change at x[" + i.to_s + "]"
end
dx = dx*f.two