Borland C++ reference

poly, polyl

raw OCR

Generates a polynomial from arguments.

Defined in header <math.h>

Syntax

#include <math.h>
double poly(double  x, int degree,double coeffsU);
long double polyl(long double  x, int degree,long double coeffsU);

Portability

DOSUNIXWindowsANSI CC++ only
poly ■■■
polyl ■■

Remarks

poly generates a polynomial in x, of degree degree, with coefficients coeffslO], coeffsll],..., coeffsldegree]. For example, iin-4, the generated polynomial is coejfs[4]y^ + coeffs[3]x^ + coeffs[2]x^ + coeffs[l]x + coeffslO]

polyl is the long double version; it takes long double arguments and returns a long double result.

Return value

poly and polyl return the value of the polynomial as evaluated for the given X.

Example

#include <stdio.h>
#include <math.h>

/* polynomial:  x**3   2x**2 + 5x - 1 V
int main(void)

   double result, array[] = { -1.0, 5.0, -2.0, 1.0  :
   result = poly(2.0, 3, array);
   printf("The polynomial: x**3 - 2.0x**2 + 5x - 1"
          " at 2.0 is %lf\n", result);
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.