/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * This file is distributed subject to a Software License Agreement found * in the file LICENSE that is included with this distribution. \*************************************************************************/ /* $Log: poly.c,v $ Revision 1.5 2003/11/07 16:46:56 borland Added function solveQuadratic() to solve quadratic equations. Revision 1.4 2002/08/14 16:18:59 soliday Added Open License Revision 1.3 2000/04/05 22:18:13 soliday Renamed poly when using Borland C. It conflicted with a built-in function. Revision 1.2 1995/09/05 21:20:43 saunders First test release of the SDDS1.5 package. */ /* routine: poly() * purpose: evaluate polynomial given array of coefficients * * Michael Borland, 1987. */ #include "mdb.h" #if defined(__BORLANDC__) double poly2(double *a, long n, double x) #else double poly(double *a, long n, double x) #endif { register long i; register double sum, xp; sum = 0; xp = 1; for (i=0; i