From 50dd862646f52da159de3fdede8ad9db3deb4c93 Mon Sep 17 00:00:00 2001 From: claudio Date: Sat, 21 Oct 2017 09:04:22 -0400 Subject: [PATCH] Fixed bug in root finder. --- newrpl/solvers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/newrpl/solvers.c b/newrpl/solvers.c index 59666d0..b5017bf 100644 --- a/newrpl/solvers.c +++ b/newrpl/solvers.c @@ -287,7 +287,7 @@ WORDPTR rplPolyRootEx(WORDPTR *first,BINT degree) if(Exceptions) { Context.precdigits=oldprec; return 0; } if(iszeroReal(&err) || (intdigitsReal(&err)<-(2*oldprec))) { pk=rplPopData(); rplOverwriteData(1,pk); } // REAL ROOT ALONE IS STILL GOOD, USE IT - + else { rplPopData(); pk=rplPeekData(1); } } else if( (digre<-10) && (digim>digre+10)) { @@ -307,7 +307,7 @@ WORDPTR rplPolyRootEx(WORDPTR *first,BINT degree) if(Exceptions) { Context.precdigits=oldprec; return 0; } if(iszeroReal(&err) || (intdigitsReal(&err)<-(2*oldprec))) { pk=rplPopData(); rplOverwriteData(1,pk); } // IMAG. ROOT ALONE IS STILL GOOD, USE IT - + else { rplPopData(); pk=rplPeekData(1); } } @@ -342,6 +342,7 @@ WORDPTR rplPolyRootEx(WORDPTR *first,BINT degree) if(Exceptions) { Context.precdigits=oldprec; return 0; } if(iszeroReal(&err) || (intdigitsReal(&err)<-(2*oldprec))) { pk=rplPopData(); rplOverwriteData(1,pk); } // INTEGER ROOT ALONE IS STILL GOOD, USE IT + else { rplPopData(); pk=rplPeekData(1); } } }