toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] tag/src util.c


From: Gerhard Reitmayr
Subject: [Toon-members] tag/src util.c
Date: Thu, 23 Apr 2009 17:20:33 +0000

CVSROOT:        /cvsroot/toon
Module name:    tag
Changes by:     Gerhard Reitmayr <gerhard>      09/04/23 17:20:33

Modified files:
        src            : util.c 

Log message:
        stop root finding from mindless iterations... big performance gain

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tag/src/util.c?cvsroot=toon&r1=1.1&r2=1.2

Patches:
Index: util.c
===================================================================
RCS file: /cvsroot/toon/tag/src/util.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- util.c      22 Apr 2009 23:23:12 -0000      1.1
+++ util.c      23 Apr 2009 17:20:27 -0000      1.2
@@ -14,8 +14,7 @@
  *
  *     evaluate polynomial defined in coef returning its value.
  */
-double
-evalpoly (ord, coef, x)
+inline double evalpoly (ord, coef, x)
        int             ord;
        double  *coef, x;
 {
@@ -94,6 +93,10 @@
                                *val = x;
                                return(1);
                }
+               if(fabs(a-b)/(fabs(a)+1e-20) < RELERROR){
+                       *val = x;
+                       return(0);
+               }
 
                if ((fa * fx) < 0) {
                                b = x;
@@ -110,10 +113,7 @@
                lfx = fx;
        }
 
-       // fprintf(stderr, "modrf overflow %f %f %f\n", a, b, fx);
+       fprintf(stderr, "\nmodrf overflow %20.17e %20.17e %20.17e %20.17e 
%20.17e %20.17e %20.17e\n", a, b, a-b, fa, fb, fx, fabs(a-b)/(fabs(a)+1e-20));
 
        return(0);
 }
-       
-
-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]