From 1077fa4d772832f77a677ce7fb7c2d513b959e3f Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 10 May 2001 00:40:28 +0000 Subject: uClibc now has a math library. muahahahaha! -Erik --- libm/double/bernum.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 libm/double/bernum.c (limited to 'libm/double/bernum.c') diff --git a/libm/double/bernum.c b/libm/double/bernum.c new file mode 100644 index 000000000..e401ff5df --- /dev/null +++ b/libm/double/bernum.c @@ -0,0 +1,74 @@ +/* This program computes the Bernoulli numbers. + * See radd.c for rational arithmetic. + */ + +typedef struct{ + double n; + double d; + }fract; + +#define PD 44 +fract x[PD+1] = {0.0}; +fract p[PD+1] = {0.0}; +#include +#ifdef ANSIPROT +extern double fabs ( double ); +extern double log10 ( double ); +#else +double fabs(), log10(); +#endif +extern double MACHEP; + +main() +{ +int nx, np, nu; +int i, j, k, n, sign; +fract r, s, t; + + +for(i=0; i<=PD; i++ ) + { + x[i].n = 0.0; + x[i].d = 1.0; + p[i].n = 0.0; + p[i].d = 1.0; + } +p[0].n = 1.0; +p[0].d = 1.0; +p[1].n = 1.0; +p[1].d = 1.0; +np = 1; +x[0].n = 1.0; +x[0].d = 1.0; + +for( n=1; n