Ticket #9543: cephes-2.8.p0.diff

File cephes-2.8.p0.diff, 95.9 KB (added by jpflori, 9 years ago)

Spkg diff, for review only.

  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    1515point arithmetic and a q-type calculator program; c9x-complex: new C
    1616language standard C9X data type for complex variables, header
    1717complex.h for GNU C and functions in float complex, double complex,
    18 and long double complex precisions. 
     18and long double complex precisions.
    1919
    2020Website: http://www.moshier.net/
    2121
     
    2323
    2424== Changelog ==
    2525
     26=== cephes-2.8.p0 (Peter Jeremy, Jean-Pierre Flori, 19 December 2012) ===
     27 * #9543: Only patch and build Cephes on FreeBSD.
     28
    2629=== cephes-2.8 (Mike Hansen, April 26th, 2010) ===
    2730 * Initial version
  • new file patches/bsd.patch

    diff --git a/patches/bsd.patch b/patches/bsd.patch
    new file mode 100644
    - +  
     1diff -drNu src.orig/c9x-complex/cgamma.c src/c9x-complex/cgamma.c
     2--- src.orig/c9x-complex/cgamma.c       2010-04-06 11:46:28.000000000 +0200
     3+++ src/c9x-complex/cgamma.c    2013-01-08 15:07:41.335642544 +0100
     4@@ -258,7 +258,7 @@
     5            w = clgam(1.0 - x);
     6            c = LOGPI - clog( u ) - w;
     7            /* Adjust for reduced sine arg.  */
     8-           cimag(c) += PI * p;
     9+           (double)(__imag__ c = (cimag(c) + PI * p));
     10          }
     11        goto ldone;
     12        }
     13diff -drNu src.orig/c9x-complex/cgammaf.c src/c9x-complex/cgammaf.c
     14--- src.orig/c9x-complex/cgammaf.c      2010-04-06 11:46:28.000000000 +0200
     15+++ src/c9x-complex/cgammaf.c   2013-01-08 15:07:41.343641844 +0100
     16@@ -80,7 +80,7 @@
     17 Copyright 1984, 1998 Stephen L. Moshier
     18 */
     19 
     20-#include <complex.h>
     21+#include "complex.h"
     22 #include "mconf.h"
     23 
     24 #define MAXGAM 171.624376956302725
     25@@ -101,8 +101,14 @@
     26 static float SQTPI = 2.50662827463100050242f;
     27 
     28 extern float MAXLOGF, MAXNUMF, PIF;
     29-#ifndef ANSIPROT
     30+#ifdef ANSIPROT
     31+extern float sinhf ( float x );
     32+extern float coshf ( float x );
     33+extern float sinf ( float x );
     34+extern float cosf ( float x );
     35+#else
     36 float logf(), sinf(), polevlf(), p1evlf(), floorf(), fabsf();
     37+float cosf(), sinhf(), coshf();
     38 float complex cpowf(), cexpf(), cabsf();
     39 #endif
     40 
     41@@ -145,6 +151,7 @@
     42 {
     43 float p, q;
     44 float complex c, u;
     45+int k;
     46 
     47 if( fabsf(crealf(x)) > 13.0f )
     48        {
     49@@ -152,14 +159,25 @@
     50                {
     51                q = crealf(x);
     52                p = floorf(q);
     53-               if( p == q )
     54+               if((p == q ) && (cimag(x) == 0.0f))
     55                        {
     56 cgoverf:
     57                        mtherr( "cgammaf", OVERFLOW );
     58                        return( MAXNUMF + I * MAXNUMF);
     59                        }
     60-               c = csinf( PIF * (x - p) );
     61-               c = PIF/(c * cgammaf(1.0f - x) );
     62+               /* Compute sin(pi x)  */
     63+               k = q - 2.0f * floorf (0.5f * q);
     64+               q = PIF * (q - p);
     65+               p = PIF * cimag(x);
     66+               c = sinf(q) * coshf(p) + cosf(q) * sinhf(p) * I;
     67+               if (k & 1)
     68+                 c = -c;
     69+               /* Reflection formula.
     70+                  ??? The denominator has been observed to overflow,
     71+                  producing a NaN result on a SPARCstation instead of zero.
     72+                  Example:
     73+                  cgammaf(-19.425196335160404f - 18.188121066880587f*I) */
     74+               c = PIF/(c * cgammaf(1.0f - x));
     75                }
     76        else
     77                {
     78@@ -173,8 +191,8 @@
     79 u = x;
     80 while( crealf(u) < 13.0f )
     81        {
     82-       if (crealf(u) == 0.0f)
     83-         goto cgoverf;
     84+       if ((crealf(u) == 0.0f) && (cimagf(u) == 0.0f))
     85+               goto cgoverf;
     86        c *= u;
     87        p += 1.0f;
     88        u = x + p;
     89@@ -223,7 +241,7 @@
     90   }
     91 
     92 /* Reflection formula -z gamma(-z) gamma(z) = pi / sin(pi z)  */
     93-if( crealf(x) < -7.0f )
     94+if((crealf(x) < -7.0f) || (cimagf(x) < -7.0f))
     95        {
     96        q = crealf(x);
     97        p = floorf(q);
     98@@ -247,7 +265,8 @@
     99            w = clgamf(1.0f - x);
     100            c = LOGPI - clogf( u ) - w;
     101            /* Adjust for reduced sine arg.  */
     102-           cimagf(c) += PIF * p;
     103+           //cimagf(c) += PIF * p;
     104+           (float)(__imag__ c = (cimagf(c) + PIF * p));
     105          }
     106        goto ldone;
     107        }
     108diff -drNu src.orig/c9x-complex/cgammal.c src/c9x-complex/cgammal.c
     109--- src.orig/c9x-complex/cgammal.c      2010-04-06 11:46:28.000000000 +0200
     110+++ src/c9x-complex/cgammal.c   2013-01-08 15:07:41.351641311 +0100
     111@@ -134,8 +134,14 @@
     112 static long double SQTPIL = 2.50662827463100050241576528481104525L;
     113 
     114 extern long double MAXLOGL, MAXNUML, PIL;
     115-#ifndef ANSIPROT
     116+#ifdef ANSIPROT
     117+extern long double sinhl ( long double x );
     118+extern long double coshl ( long double x );
     119+extern long double sinl ( long double x );
     120+extern long double cosl ( long double x );
     121+#else
     122 long double logl(), sinl(), polevll(), p1evll(), floorl(), fabsl();
     123+long double sinhl(), coshl(), cosl();
     124 long double complex cpowl(), cexpl(), cabsl();
     125 #endif
     126 
     127@@ -174,7 +180,7 @@
     128 {
     129 long double complex c, u;
     130 long double p, q;
     131-int cj;
     132+int cj, k;
     133 
     134 cj = 0;
     135 if (cimagl(x) < 0.0L)
     136@@ -183,34 +189,41 @@
     137     x = conj(x);
     138   }
     139 
     140-q = creall(x);
     141-if( fabsl(q) > NGITER )
     142+if( fabsl(creall(x)) > NGITER )
     143        {
     144-       if( q < 0.0L )
     145+       if( creall(x) < 0.0L )
     146                {
     147+               q = creall(x);
     148                p = floorl(q);
     149-               if( p == q )
     150+               if(( p == q ) && (cimagl(x) == 0.0L))
     151                        {
     152                        mtherr( "cgammal", OVERFLOW );
     153                        c = MAXNUML + I * MAXNUML;
     154                        goto gamdone;
     155                        }
     156-               c = csinl( PIL * (x - p) );
     157+               /*      c = csinl( PIL * x );*/
     158+               /* Compute sin(pi x)  */
     159+               k = q - 2.0L * floorl (0.5L * q);
     160+               q = PIL * (q - p);
     161+               p = PIL * cimagl(x);
     162+               c = sinl(q) * coshl(p) + cosl(q) * sinhl(p) * I;
     163+               if (k & 1)
     164+                 c = -c;
     165                c = PIL/(c * cgammal(1.0L - x) );
     166+               goto gamdone;
     167                }
     168        else
     169                {
     170-               c = cstirfl(x);
     171+                 c = cstirfl(x);
     172+                 goto gamdone;
     173                }
     174-       goto gamdone;
     175        }
     176-
     177 c = 1.0L;
     178 p = 0.0L;
     179 u = x;
     180 while( creall(u) < NGITER )
     181        {
     182-       if( fabsl (creall(u)) < GSMALL )
     183+       if((fabsl (creall(u)) < GSMALL) && (fabsl (cimagl(u)) < GSMALL))
     184                goto small;
     185        c *= u;
     186        p += 1.0L;
     187@@ -222,7 +235,7 @@
     188 
     189 
     190 small:
     191-if( creall(x) == 0.0L )
     192+if((creall(x) == 0.0L) && (cimagl(x) == 0.0L))
     193        {
     194        mtherr( "cgammal", SING );
     195        c = MAXNUML + MAXNUML * I;
     196@@ -280,7 +293,7 @@
     197 
     198 /* -z gamma(-z) gamma(z) = pi / sin(pi z) */
     199 /* log gamma(z) = log pi - log sin(pi z) - log(-z) - log gamma(-z) */
     200-if( creall(x) < -NLGITER )
     201+if((creall(x) < -NLGITER) || (cimagl(x) < -NLGITER))
     202        {
     203        q = creall(x);
     204        p = floorl(q);
     205@@ -304,7 +317,8 @@
     206            w = clgaml(1.0L - x);
     207            c = LOGPIL - clogl( u ) - w;
     208            /* Adjust for reduced sine arg.  */
     209-           cimagl(c) += PIL * p;
     210+           //cimagl(c) += PIL * p;
     211+           (long double)(__imag__ c = cimagl(c) + PIL * p);
     212          }
     213        goto ldone;
     214        }
     215diff -drNu src.orig/c9x-complex/complex.h src/c9x-complex/complex.h
     216--- src.orig/c9x-complex/complex.h      2000-02-06 02:39:53.000000000 +0100
     217+++ src/c9x-complex/complex.h   2013-01-08 15:07:41.359640920 +0100
     218@@ -1,126 +1,131 @@
     219-/* This is a C9X complex.h implementation for the GNU C compiler.
     220-   It uses GNU extensions such as __complex__, but defines them
     221-   so the syntax specified by C9X works.
     222+/*
     223+** Replacement <complex.h> merging host version with cephes functions
     224+*/
     225 
     226-   S. L. Moshier
     227-   February, 1997  */
     228+/* Start by using host complex file.
     229+ * This has to come before the following protective #ifdef so that
     230+ * #include "complex.h" is correctly handled. */
     231+#include_next <complex.h>
     232 
     233+#ifndef __CEPHES_COMPLEX_H
     234+#define __CEPHES_COMPLEX_H
     235 
     236-/* This may look like something else, but it is really C9X.  */
     237+#if defined(__cplusplus)
     238+extern "C" {
     239+#endif
     240 
     241-/* Use `I' as the imaginary unit.
     242-   Initialize complex constants like this:
     243-   double complex c = 1.0 + 2.0 * I;  */
     244-#define _Imaginary_I (1.0fi)
     245-#define I _Imaginary_I
     246+/* The following content is derived from
     247+ * http://www.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html
     248+ */
     249+extern double              (cabs)(double complex);
     250+extern float               (cabsf)(float complex);
     251+extern long double         (cabsl)(long double complex);
     252+extern double complex      (cacos)(double complex);
     253+extern float complex       (cacosf)(float complex);
     254+extern double complex      (cacosh)(double complex);
     255+extern float complex       (cacoshf)(float complex);
     256+extern long double complex (cacoshl)(long double complex);
     257+extern long double complex (cacosl)(long double complex);
     258+extern double complex      (cadd)(double complex a, double complex b); /*ceph*/
     259+extern double              (carg)(double complex);
     260+extern float               (cargf)(float complex);
     261+extern long double         (cargl)(long double complex);
     262+extern double complex      (casin)(double complex);
     263+extern float complex       (casinf)(float complex);
     264+extern double complex      (casinh)(double complex);
     265+extern float complex       (casinhf)(float complex);
     266+extern long double complex (casinhl)(long double complex);
     267+extern long double complex (casinl)(long double complex);
     268+extern double complex      (catan)(double complex);
     269+extern float complex       (catanf)(float complex);
     270+extern double complex      (catanh)(double complex);
     271+extern float complex       (catanhf)(float complex);
     272+extern long double complex (catanhl)(long double complex);
     273+extern long double complex (catanl)(long double complex);
     274+extern double complex      (ccos)(double complex);
     275+extern float complex       (ccosf)(float complex);
     276+extern double complex      (ccosh)(double complex);
     277+extern float complex       (ccoshf)(float complex);
     278+extern long double complex (ccoshl)(long double complex);
     279+extern long double complex (ccosl)(long double complex);
     280+extern double complex      (ccot)(double complex z);                   /*ceph*/
     281+extern float complex       (ccotf)(float complex z);                   /*ceph*/
     282+extern long double complex (ccotl)(long double complex z);             /*ceph*/
     283+extern double complex      (cdiv)(double complex a, double complex b); /*ceph*/
     284+extern double complex      (cexp)(double complex);
     285+extern float complex       (cexpf)(float complex);
     286+extern long double complex (cexpl)(long double complex);
     287+extern double complex      (cgamma)(double complex z);                 /*ceph*/
     288+extern float complex       (cgammaf)(float complex z);                 /*ceph*/
     289+extern long double complex (cgammal)(long double complex z);           /*ceph*/
     290+extern double              (cimag)(double complex);
     291+extern float               (cimagf)(float complex);
     292+extern long double         (cimagl)(long double complex);
     293+extern double complex     (clgam)(double complex z);                  /*ceph*/
     294+extern float complex       (clgamf)(float complex z);                  /*ceph*/
     295+extern long double complex (clgaml)(long double complex z);            /*ceph*/
     296+extern double complex      (clog)(double complex);
     297+extern float complex       (clogf)(float complex);
     298+extern long double complex (clogl)(long double complex);
     299+extern double complex      (cmul)(double complex a, double complex b); /*ceph*/
     300+extern double complex      (conj)(double complex);
     301+extern float complex       (conjf)(float complex);
     302+extern long double complex (conjl)(long double complex);
     303+extern double complex      (cpow)(double complex, double complex);
     304+extern float complex       (cpowf)(float complex, float complex);
     305+extern long double complex (cpowl)(long double complex, long double complex);
     306+extern double complex      (cproj)(double complex);
     307+extern float complex       (cprojf)(float complex);
     308+extern long double complex (cprojl)(long double complex);
     309+extern double              (creal)(double complex);
     310+extern float               (crealf)(float complex);
     311+extern long double         (creall)(long double complex);
     312+extern double complex      (csin)(double complex);
     313+extern float complex       (csinf)(float complex);
     314+extern double complex      (csinh)(double complex);
     315+extern float complex       (csinhf)(float complex);
     316+extern long double complex (csinhl)(long double complex);
     317+extern long double complex (csinl)(long double complex);
     318+extern double complex      (csqrt)(double complex);
     319+extern float complex       (csqrtf)(float complex);
     320+extern long double complex (csqrtl)(long double complex);
     321+extern double complex      (csub)(double complex a, double complex b); /*ceph*/
     322+extern double complex      (ctan)(double complex);
     323+extern float complex       (ctanf)(float complex);
     324+extern double complex      (ctanh)(double complex);
     325+extern float complex       (ctanhf)(float complex);
     326+extern long double complex (ctanhl)(long double complex);
     327+extern long double complex (ctanl)(long double complex);
     328 
     329+/* macro versions of some of the above functions, from the cephes complex.h */
     330 /* These are not typed in gcc.  They preseve the type of the argument.  */
     331 /* Complex conjugate function.  */
     332 #define conj(x) (~(x))
     333 /* Function to get imaginary part.  */
     334-#define cimag(x) (__imag__ (x))
     335+#define cimag(x) (__imag__(x))
     336 /* Function to get real part.  */
     337-#define creal(x) (__real__ (x))
     338+#define creal(x) (__real__(x))
     339 
     340-extern double atan2 (double, double);
     341-#define carg(z) (atan2 ((double) cimag (z), (double) creal (z)))
     342+extern double (atan2)(double, double);
     343+#define carg(z) (atan2((double)cimag(z), (double)creal(z)))
     344 
     345-/* This is the new C language key word.
     346-   ... Actually, the key word that the compiler is supposed to reserve
     347-   and understand as part of the language is spelled "_Complex" but
     348-   gcc understands "__complex__."  The macro "complex" is supposed to
     349-   exist and expand to _Complex in complex.h.  But "_Complex" will seldom
     350-   if ever appear in user programs.  */
     351-#define complex __complex__
     352-/* Remove this whenever gcc implements _Complex as a key word.  */
     353-#define _Complex __complex__
     354+/* There are float and long double sizes, too.  */
     355+#define cimagf(x) ((float)__imag__(x))
     356+#define crealf(x) ((float)__real__(x))
     357+extern float (atan2f)(float, float);
     358+#define cargf(z) (atan2f((float)cimag(z), (float)creal(z)))
     359+
     360+#define cimagl(x) ((long double)__imag__(x))
     361+#define creall(x) ((long double)__real__(x))
     362+extern long double (atan2l)(long double, long double);
     363+#define cargl(z) (atan2l((long double)cimag(z), (long double)creal(z)))
     364 
     365 /* These pragmas can't work without a compiler modification.  */
     366 #define CX_LIMITED_RANGE_ON
     367 #define CX_LIMITED_RANGE_OFF
     368 #define CX_LIMITED_RANGE_DEFAULT CX_LIMITED_RANGE_ON
     369 
     370-/* The builtin complex absolute value in gcc currently is unreachable
     371-   due to overzealous type checking.  */
     372-extern double cabs ( double complex z );
     373-extern double hypot ( double x, double y );
     374-
     375-/* Prototypes for clog.c.
     376-   This is how you declare complex things in the new C language.  */
     377-extern double complex clog ( double complex z );
     378-extern double complex cexp ( double complex z );
     379-extern double complex csqrt ( double complex z );
     380-extern double complex csin ( double complex z );
     381-extern double complex ccos ( double complex z );
     382-extern double complex ctan ( double complex z );
     383-extern double complex ccot ( double complex z );
     384-extern double complex casin ( double complex z );
     385-extern double complex cacos ( double complex z );
     386-extern double complex catan ( double complex z );
     387-extern double complex csinh ( double complex z );
     388-extern double complex casinh ( double complex z );
     389-extern double complex ccosh ( double complex z );
     390-extern double complex cacosh ( double complex z );
     391-extern double complex ctanh ( double complex z );
     392-extern double complex catanh ( double complex z );
     393-extern double complex cpow (double complex a, double complex z);
     394-
     395-/* These functions might be used if the compiler were to generate
     396-   subroutine calls.  But their names would be spelled some other way.  */
     397-extern double complex cadd ( double complex a, double complex b );
     398-extern double complex csub ( double complex a, double complex b );
     399-extern double complex cmul ( double complex a, double complex b );
     400-extern double complex cdiv ( double complex a, double complex b );
     401-
     402-/* There are float and long double sizes, too.  */
     403-#define cimagf(x) ((float) __imag__ (x))
     404-#define crealf(x) ((float) __real__ (x))
     405-extern float atan2f (float, float);
     406-#define cargf(z) (atan2f ((float) cimag (z), (float) creal (z)))
     407-extern float cabsf ( float complex z );
     408-extern float complex clogf ( float complex z );
     409-extern float complex cexpf ( float complex z );
     410-extern float complex csqrtf ( float complex z );
     411-extern float complex csinf ( float complex z );
     412-extern float complex ccosf ( float complex z );
     413-extern float complex ctanf ( float complex z );
     414-extern float complex ccotf ( float complex z );
     415-extern float complex casinf ( float complex z );
     416-extern float complex cacosf ( float complex z );
     417-extern float complex catanf ( float complex z );
     418-extern float complex csinhf ( float complex z );
     419-extern float complex casinhf ( float complex z );
     420-extern float complex ccoshf ( float complex z );
     421-extern float complex cacoshf ( float complex z );
     422-extern float complex ctanhf ( float complex z );
     423-extern float complex catanhf ( float complex z );
     424-extern float complex cpowf (float complex a, float complex z);
     425-
     426-#define cimagl(x) ((long double) __imag__ (x))
     427-#define creall(x) ((long double) __real__ (x))
     428-extern long double atan2l (long double, long double);
     429-#define cargl(z) (atan2l ((long double) cimag (z), (long double) creal (z)))
     430-extern long double cabsl ( long double complex z );
     431-extern long double complex clogl ( long double complex z );
     432-extern long double complex cexpl ( long double complex z );
     433-extern long double complex csqrtl ( long double complex z );
     434-extern long double complex csinl ( long double complex z );
     435-extern long double complex ccosl ( long double complex z );
     436-extern long double complex ctanl ( long double complex z );
     437-extern long double complex ccotl ( long double complex z );
     438-extern long double complex casinl ( long double complex z );
     439-extern long double complex cacosl ( long double complex z );
     440-extern long double complex catanl ( long double complex z );
     441-extern long double complex csinhl ( long double complex z );
     442-extern long double complex casinhl ( long double complex z );
     443-extern long double complex ccoshl ( long double complex z );
     444-extern long double complex cacoshl ( long double complex z );
     445-extern long double complex ctanhl ( long double complex z );
     446-extern long double complex catanhl ( long double complex z );
     447-extern long double complex cpowl (long double complex a, long double complex z);
     448-extern float complex clgamf ( float complex z );
     449-extern double complex clgam ( double complex z );
     450-extern long double complex clgaml ( long double complex z );
     451-extern float complex cgammaf ( float complex z );
     452-extern double complex cgamma ( double complex z );
     453-extern long double complex cgammal ( long double complex z );
     454+#if defined(__cplusplus)
     455+}
     456+#endif
     457+#endif
     458diff -drNu src.orig/c9x-complex/makefile src/c9x-complex/makefile
     459--- src.orig/c9x-complex/makefile       2010-04-06 11:46:28.000000000 +0200
     460+++ src/c9x-complex/makefile    2013-01-08 15:07:41.367640529 +0100
     461@@ -1,17 +1,25 @@
     462 # Makefile for C9X complex variables library
     463 # Edit endian-ness and computer type properly in mconf.h before compiling.
     464+# For additional test programs see also celefunt.mak.
     465 
     466-#CC = gcc
     467-CC=/b/gnu/linux/gcc/xgcc -B/b/gnu/linux/gcc/ -I/b/gnu/linux/include
     468+# Caution: the tests contain some references to the cephes math library
     469+# or references to standard float or long double functions that might
     470+# not be available.
     471+# This should be enough to run at least the double precision functions:
     472+LIBS = stubs.o -lm
     473+# These are intended to get the cephes libraries:
     474+#LIBS = -lml -lmd -lmf
     475+#LIBS = ../libml.a ../libmd.a ../libmf.a
     476+
     477+CC = gcc
     478+#CC = /b/gnu/gcc-build/gcc/xgcc -B/b/gnu/gcc-build/gcc/ -I/b/gnu/gcc-build/gcc
     479 # For 128-bit wide long double
     480 #PRECFLAGS = -DLD128BITS
     481 PRECFLAGS =
     482-CFLAGS = $(PRECFLAGS) -g -O2 -Wall
     483-# This should be enough to run at least the double precision functions
     484-#LIBS = stubs.o -lm
     485-# These are intended to get the cephes libraries
     486-LIBS = -lml -lmd -lmf
     487-#LIBS = ../libml.a ../libmd.a ../libmf.a
     488+CFLAGS = $(PRECFLAGS) -I. -g -O2 -Wall
     489+#CFLAGS = $(PRECFLAGS) -I. -g -O1 -Wall
     490+#CFLAGS = $(PRECFLAGS) -I. -g -O0 -Wall
     491+
     492 # float precision
     493 SFILES = cmplxf.o clogf.o cgammaf.o
     494 # double precision
     495@@ -22,7 +30,7 @@
     496 LIBMCFILES = $(SFILES) $(DFILES) $(LFILES)
     497 
     498 # mtstf and mtstl test the float and long double functions.
     499-all: libmc.a mtst cvect dccalc mtstf mtstl
     500+all: libmc.a mtst cvect dccalc mtstf whitebxf whitebx
     501 
     502 mtst: mtst.o $(DFILES) stubs.o
     503        $(CC) -v -o mtst mtst.o $(DFILES) $(LIBS)
     504@@ -36,8 +44,19 @@
     505 cvect: cvect.o clog.o cmplx.o stubs.o
     506        $(CC) -o cvect cvect.o clog.o cmplx.o $(LIBS)
     507 
     508-cvect-nans: cvect-nans.o clog-nans.o cmplx-nans.o
     509-       $(CC) -o cvect-nans cvect-nans.o clog-nans.o cmplx-nans.o $(LIBS)
     510+#cvect-nans: cvect-nans.o clog-nans.o cmplx-nans.o
     511+#      $(CC) -o cvect-nans cvect-nans.o clog-nans.o cmplx-nans.o $(LIBS)
     512+
     513+whitebxf: whitebxf.o libmc.a
     514+       $(CC) $(CFLAGS) -o whitebxf whitebxf.o libmc.a $(LIBS)
     515+
     516+whitebxf.o: whitebxf.c complex.h
     517+
     518+whitebx: whitebx.o  libmc.a
     519+       $(CC) $(CFLAGS) -o whitebx whitebx.o libmc.a $(LIBS)
     520+
     521+whitebx.o: whitebx.c complex.h
     522+
     523 
     524 libmc.a: $(LIBMCFILES)
     525        rm -f libmc.a
     526@@ -66,11 +85,13 @@
     527 #clog-nans.o: clog-nans.c complex.h protos.h
     528 #cmplx-nans.o: cmplx-nans.c complex.h protos.h
     529 
     530-check: mtst cvect mtstf
     531-       -mtstf
     532-       -cvect
     533-       -mtst
     534-       -mtstl
     535+check: mtst cvect mtstf whitebxf whitebx
     536+       -./mtstf
     537+       -./cvect
     538+       -./mtst
     539+       -./whitebxf
     540+       -./whitebx
     541+       echo For additional tests, make -f celefunt.mak
     542 
     543 clean:
     544        rm -f *.o
     545@@ -93,11 +114,13 @@
     546        rm -f tcsinf
     547        rm -f tcsqrt
     548        rm -f tcsqrtf
     549+       rm -f whitebxf
     550+       rm -f whitebx
     551 
     552-zip:
     553-       rm -f c9x-complex.zip
     554-       rm -f c9x-complex.shar
     555-       rm -f c9x-complex.shar.gz
     556-       zip c9x-complex.zip *.c *.h *.pat *.doc *.mak makefile read.me
     557-       shar *.c *.h *.pat *.doc *.mak makefile read.me > c9x-complex.shar
     558-       gzip c9x-complex.shar
     559+#zip:
     560+#      rm -f c9x-complex.zip
     561+#      rm -f c9x-complex.shar
     562+#      rm -f c9x-complex.shar.gz
     563+#      zip c9x-complex.zip *.c *.h *.pat *.doc *.mak makefile read.me
     564+#      shar *.c *.h *.pat *.doc *.mak makefile read.me > c9x-complex.shar
     565+#      gzip c9x-complex.shar
     566diff -drNu src.orig/complex.h src/complex.h
     567--- src.orig/complex.h  2000-02-06 02:39:53.000000000 +0100
     568+++ src/complex.h       2013-01-08 15:07:41.375640150 +0100
     569@@ -1,126 +1,131 @@
     570-/* This is a C9X complex.h implementation for the GNU C compiler.
     571-   It uses GNU extensions such as __complex__, but defines them
     572-   so the syntax specified by C9X works.
     573+/*
     574+** Replacement <complex.h> merging host version with cephes functions
     575+*/
     576 
     577-   S. L. Moshier
     578-   February, 1997  */
     579+/* Start by using host complex file.
     580+ * This has to come before the following protective #ifdef so that
     581+ * #include "complex.h" is correctly handled. */
     582+#include_next <complex.h>
     583 
     584+#ifndef __CEPHES_COMPLEX_H
     585+#define __CEPHES_COMPLEX_H
     586 
     587-/* This may look like something else, but it is really C9X.  */
     588+#if defined(__cplusplus)
     589+extern "C" {
     590+#endif
     591 
     592-/* Use `I' as the imaginary unit.
     593-   Initialize complex constants like this:
     594-   double complex c = 1.0 + 2.0 * I;  */
     595-#define _Imaginary_I (1.0fi)
     596-#define I _Imaginary_I
     597+/* The following content is derived from
     598+ * http://www.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html
     599+ */
     600+extern double              (cabs)(double complex);
     601+extern float               (cabsf)(float complex);
     602+extern long double         (cabsl)(long double complex);
     603+extern double complex      (cacos)(double complex);
     604+extern float complex       (cacosf)(float complex);
     605+extern double complex      (cacosh)(double complex);
     606+extern float complex       (cacoshf)(float complex);
     607+extern long double complex (cacoshl)(long double complex);
     608+extern long double complex (cacosl)(long double complex);
     609+extern double complex      (cadd)(double complex a, double complex b); /*ceph*/
     610+extern double              (carg)(double complex);
     611+extern float               (cargf)(float complex);
     612+extern long double         (cargl)(long double complex);
     613+extern double complex      (casin)(double complex);
     614+extern float complex       (casinf)(float complex);
     615+extern double complex      (casinh)(double complex);
     616+extern float complex       (casinhf)(float complex);
     617+extern long double complex (casinhl)(long double complex);
     618+extern long double complex (casinl)(long double complex);
     619+extern double complex      (catan)(double complex);
     620+extern float complex       (catanf)(float complex);
     621+extern double complex      (catanh)(double complex);
     622+extern float complex       (catanhf)(float complex);
     623+extern long double complex (catanhl)(long double complex);
     624+extern long double complex (catanl)(long double complex);
     625+extern double complex      (ccos)(double complex);
     626+extern float complex       (ccosf)(float complex);
     627+extern double complex      (ccosh)(double complex);
     628+extern float complex       (ccoshf)(float complex);
     629+extern long double complex (ccoshl)(long double complex);
     630+extern long double complex (ccosl)(long double complex);
     631+extern double complex      (ccot)(double complex z);                   /*ceph*/
     632+extern float complex       (ccotf)(float complex z);                   /*ceph*/
     633+extern long double complex (ccotl)(long double complex z);             /*ceph*/
     634+extern double complex      (cdiv)(double complex a, double complex b); /*ceph*/
     635+extern double complex      (cexp)(double complex);
     636+extern float complex       (cexpf)(float complex);
     637+extern long double complex (cexpl)(long double complex);
     638+extern double complex      (cgamma)(double complex z);                 /*ceph*/
     639+extern float complex       (cgammaf)(float complex z);                 /*ceph*/
     640+extern long double complex (cgammal)(long double complex z);           /*ceph*/
     641+extern double              (cimag)(double complex);
     642+extern float               (cimagf)(float complex);
     643+extern long double         (cimagl)(long double complex);
     644+extern double complex     (clgam)(double complex z);                  /*ceph*/
     645+extern float complex       (clgamf)(float complex z);                  /*ceph*/
     646+extern long double complex (clgaml)(long double complex z);            /*ceph*/
     647+extern double complex      (clog)(double complex);
     648+extern float complex       (clogf)(float complex);
     649+extern long double complex (clogl)(long double complex);
     650+extern double complex      (cmul)(double complex a, double complex b); /*ceph*/
     651+extern double complex      (conj)(double complex);
     652+extern float complex       (conjf)(float complex);
     653+extern long double complex (conjl)(long double complex);
     654+extern double complex      (cpow)(double complex, double complex);
     655+extern float complex       (cpowf)(float complex, float complex);
     656+extern long double complex (cpowl)(long double complex, long double complex);
     657+extern double complex      (cproj)(double complex);
     658+extern float complex       (cprojf)(float complex);
     659+extern long double complex (cprojl)(long double complex);
     660+extern double              (creal)(double complex);
     661+extern float               (crealf)(float complex);
     662+extern long double         (creall)(long double complex);
     663+extern double complex      (csin)(double complex);
     664+extern float complex       (csinf)(float complex);
     665+extern double complex      (csinh)(double complex);
     666+extern float complex       (csinhf)(float complex);
     667+extern long double complex (csinhl)(long double complex);
     668+extern long double complex (csinl)(long double complex);
     669+extern double complex      (csqrt)(double complex);
     670+extern float complex       (csqrtf)(float complex);
     671+extern long double complex (csqrtl)(long double complex);
     672+extern double complex      (csub)(double complex a, double complex b); /*ceph*/
     673+extern double complex      (ctan)(double complex);
     674+extern float complex       (ctanf)(float complex);
     675+extern double complex      (ctanh)(double complex);
     676+extern float complex       (ctanhf)(float complex);
     677+extern long double complex (ctanhl)(long double complex);
     678+extern long double complex (ctanl)(long double complex);
     679 
     680+/* macro versions of some of the above functions, from the cephes complex.h */
     681 /* These are not typed in gcc.  They preseve the type of the argument.  */
     682 /* Complex conjugate function.  */
     683 #define conj(x) (~(x))
     684 /* Function to get imaginary part.  */
     685-#define cimag(x) (__imag__ (x))
     686+#define cimag(x) (__imag__(x))
     687 /* Function to get real part.  */
     688-#define creal(x) (__real__ (x))
     689+#define creal(x) (__real__(x))
     690 
     691-extern double atan2 (double, double);
     692-#define carg(z) (atan2 ((double) cimag (z), (double) creal (z)))
     693+extern double (atan2)(double, double);
     694+#define carg(z) (atan2((double)cimag(z), (double)creal(z)))
     695 
     696-/* This is the new C language key word.
     697-   ... Actually, the key word that the compiler is supposed to reserve
     698-   and understand as part of the language is spelled "_Complex" but
     699-   gcc understands "__complex__."  The macro "complex" is supposed to
     700-   exist and expand to _Complex in complex.h.  But "_Complex" will seldom
     701-   if ever appear in user programs.  */
     702-#define complex __complex__
     703-/* Remove this whenever gcc implements _Complex as a key word.  */
     704-#define _Complex __complex__
     705+/* There are float and long double sizes, too.  */
     706+#define cimagf(x) ((float)__imag__(x))
     707+#define crealf(x) ((float)__real__(x))
     708+extern float (atan2f)(float, float);
     709+#define cargf(z) (atan2f((float)cimag(z), (float)creal(z)))
     710+
     711+#define cimagl(x) ((long double)__imag__(x))
     712+#define creall(x) ((long double)__real__(x))
     713+extern long double (atan2l)(long double, long double);
     714+#define cargl(z) (atan2l((long double)cimag(z), (long double)creal(z)))
     715 
     716 /* These pragmas can't work without a compiler modification.  */
     717 #define CX_LIMITED_RANGE_ON
     718 #define CX_LIMITED_RANGE_OFF
     719 #define CX_LIMITED_RANGE_DEFAULT CX_LIMITED_RANGE_ON
     720 
     721-/* The builtin complex absolute value in gcc currently is unreachable
     722-   due to overzealous type checking.  */
     723-extern double cabs ( double complex z );
     724-extern double hypot ( double x, double y );
     725-
     726-/* Prototypes for clog.c.
     727-   This is how you declare complex things in the new C language.  */
     728-extern double complex clog ( double complex z );
     729-extern double complex cexp ( double complex z );
     730-extern double complex csqrt ( double complex z );
     731-extern double complex csin ( double complex z );
     732-extern double complex ccos ( double complex z );
     733-extern double complex ctan ( double complex z );
     734-extern double complex ccot ( double complex z );
     735-extern double complex casin ( double complex z );
     736-extern double complex cacos ( double complex z );
     737-extern double complex catan ( double complex z );
     738-extern double complex csinh ( double complex z );
     739-extern double complex casinh ( double complex z );
     740-extern double complex ccosh ( double complex z );
     741-extern double complex cacosh ( double complex z );
     742-extern double complex ctanh ( double complex z );
     743-extern double complex catanh ( double complex z );
     744-extern double complex cpow (double complex a, double complex z);
     745-
     746-/* These functions might be used if the compiler were to generate
     747-   subroutine calls.  But their names would be spelled some other way.  */
     748-extern double complex cadd ( double complex a, double complex b );
     749-extern double complex csub ( double complex a, double complex b );
     750-extern double complex cmul ( double complex a, double complex b );
     751-extern double complex cdiv ( double complex a, double complex b );
     752-
     753-/* There are float and long double sizes, too.  */
     754-#define cimagf(x) ((float) __imag__ (x))
     755-#define crealf(x) ((float) __real__ (x))
     756-extern float atan2f (float, float);
     757-#define cargf(z) (atan2f ((float) cimag (z), (float) creal (z)))
     758-extern float cabsf ( float complex z );
     759-extern float complex clogf ( float complex z );
     760-extern float complex cexpf ( float complex z );
     761-extern float complex csqrtf ( float complex z );
     762-extern float complex csinf ( float complex z );
     763-extern float complex ccosf ( float complex z );
     764-extern float complex ctanf ( float complex z );
     765-extern float complex ccotf ( float complex z );
     766-extern float complex casinf ( float complex z );
     767-extern float complex cacosf ( float complex z );
     768-extern float complex catanf ( float complex z );
     769-extern float complex csinhf ( float complex z );
     770-extern float complex casinhf ( float complex z );
     771-extern float complex ccoshf ( float complex z );
     772-extern float complex cacoshf ( float complex z );
     773-extern float complex ctanhf ( float complex z );
     774-extern float complex catanhf ( float complex z );
     775-extern float complex cpowf (float complex a, float complex z);
     776-
     777-#define cimagl(x) ((long double) __imag__ (x))
     778-#define creall(x) ((long double) __real__ (x))
     779-extern long double atan2l (long double, long double);
     780-#define cargl(z) (atan2l ((long double) cimag (z), (long double) creal (z)))
     781-extern long double cabsl ( long double complex z );
     782-extern long double complex clogl ( long double complex z );
     783-extern long double complex cexpl ( long double complex z );
     784-extern long double complex csqrtl ( long double complex z );
     785-extern long double complex csinl ( long double complex z );
     786-extern long double complex ccosl ( long double complex z );
     787-extern long double complex ctanl ( long double complex z );
     788-extern long double complex ccotl ( long double complex z );
     789-extern long double complex casinl ( long double complex z );
     790-extern long double complex cacosl ( long double complex z );
     791-extern long double complex catanl ( long double complex z );
     792-extern long double complex csinhl ( long double complex z );
     793-extern long double complex casinhl ( long double complex z );
     794-extern long double complex ccoshl ( long double complex z );
     795-extern long double complex cacoshl ( long double complex z );
     796-extern long double complex ctanhl ( long double complex z );
     797-extern long double complex catanhl ( long double complex z );
     798-extern long double complex cpowl (long double complex a, long double complex z);
     799-extern float complex clgamf ( float complex z );
     800-extern double complex clgam ( double complex z );
     801-extern long double complex clgaml ( long double complex z );
     802-extern float complex cgammaf ( float complex z );
     803-extern double complex cgamma ( double complex z );
     804-extern long double complex cgammal ( long double complex z );
     805+#if defined(__cplusplus)
     806+}
     807+#endif
     808+#endif
     809diff -drNu src.orig/double/makefile src/double/makefile
     810--- src.orig/double/makefile    2010-04-06 11:46:28.000000000 +0200
     811+++ src/double/makefile 2013-01-08 15:07:41.383639902 +0100
     812@@ -22,7 +22,13 @@
     813 tan.o tandg.o tanh.o unity.o yn.o zeta.o zetac.o \
     814 sqrt.o floor.o setprec.o mtherr.o
     815 
     816-all: libmd.a mtst dtestvec monot dcalc paranoia # stamp-timing
     817+all: libmd.a mtst dtestvec monot dcalc # stamp-timing
     818+
     819+check:  mtst dtestvec monot dcalc
     820+       ./mtst
     821+       ./dtestvec
     822+       ./monot
     823+       ./dcalc
     824 
     825 stamp-timing: libmd.a mtst time-it
     826        time-it "mtst > /dev/null"
     827@@ -86,14 +92,14 @@
     828 #      $(AS) -o setprec.o setprec.387
     829 
     830 # ELF versions for linux (no underscores)
     831-sqrt.o: sqrtelf.387
     832-       $(AS) -o sqrt.o sqrtelf.387
     833+#sqrt.o: sqrtelf.387
     834+#      $(AS) -o sqrt.o sqrtelf.387
     835 
     836 #floor.o: floorelf.387
     837 #      $(AS) -o floor.o floorelf.387
     838 
     839-setprec.o: setprelf.387
     840-       $(AS) -o setprec.o setprelf.387
     841+#setprec.o: setprelf.387
     842+#      $(AS) -o setprec.o setprelf.387
     843 
     844 # Motorola 68881. Caution, subroutine return conventions vary.
     845 #sqrt.o: sqrt.688
     846diff -drNu src.orig/ldouble/gammal.c src/ldouble/gammal.c
     847--- src.orig/ldouble/gammal.c   2000-05-28 17:21:01.000000000 +0200
     848+++ src/ldouble/gammal.c        2013-01-08 15:07:41.391639726 +0100
     849@@ -6,20 +6,16 @@
     850  *
     851  * SYNOPSIS:
     852  *
     853- * long double x, y, gammal();
     854- * extern int sgngam;
     855+ * long double x, y, tgammal();
     856  *
     857- * y = gammal( x );
     858+ * y = tgammal( x );
     859  *
     860  *
     861  *
     862  * DESCRIPTION:
     863  *
     864  * Returns gamma function of the argument.  The result is
     865- * correctly signed, and the sign (+1 or -1) is also
     866- * returned in a global (extern) variable named sgngam.
     867- * This variable is also filled in by the logarithmic gamma
     868- * function lgam().
     869+ * correctly signed.
     870  *
     871  * Arguments |x| <= 13 are reduced by recurrence and the function
     872  * approximated by a rational function of degree 7/8 in the
     873@@ -38,7 +34,7 @@
     874  * Accuracy for large arguments is dominated by error in powl().
     875  *
     876  */
    0877
     878-/*                                                     lgaml()
     879+/*                                                     lgammal()
     880  *
     881  *     Natural logarithm of gamma function
     882  *
     883@@ -46,10 +42,10 @@
     884  *
     885  * SYNOPSIS:
     886  *
     887- * long double x, y, lgaml();
     888- * extern int sgngam;
     889+ * long double x, y, lgammal();
     890+ * extern int signgam;
     891  *
     892- * y = lgaml( x );
     893+ * y = lgammal( x );
     894  *
     895  *
     896  *
     897@@ -58,7 +54,7 @@
     898  * Returns the base e (2.718...) logarithm of the absolute
     899  * value of the gamma function of the argument.
     900  * The sign (+1 or -1) of the gamma function is returned in a
     901- * global (extern) variable named sgngam.
     902+ * global (extern) variable named signgam.
     903  *
     904  * For arguments greater than 33, the logarithm of the gamma
     905  * function is approximated by the logarithmic version of
     906@@ -90,7 +86,6 @@
     907 Copyright 1994 by Stephen L. Moshier
     908 */
     909 
     910-
     911 #include "mconf.h"
     912 /*
     913 gamma(x+2)  = gamma(x+2) P(x)/Q(x)
     914@@ -336,18 +331,18 @@
     915 };
     916 #endif
     917 
     918-int sgngaml = 0;
     919-extern int sgngaml;
     920+/*int signgam = 0;*/
     921+extern int signgam;
     922 extern long double MAXLOGL, MAXNUML, PIL;
     923 /* #define PIL 3.14159265358979323846L */
     924 /* #define MAXNUML 1.189731495357231765021263853E4932L */
     925 
     926 #ifdef ANSIPROT
     927 extern long double fabsl ( long double );
     928-extern long double lgaml ( long double );
     929+extern long double lgammal ( long double );
     930 extern long double logl ( long double );
     931 extern long double expl ( long double );
     932-extern long double gammal ( long double );
     933+extern long double tgammal ( long double );
     934 extern long double sinl ( long double );
     935 extern long double floorl ( long double );
     936 extern long double powl ( long double, long double );
     937@@ -357,7 +352,7 @@
     938 extern int isfinitel ( long double );
     939 static long double stirf ( long double );
     940 #else
     941-long double fabsl(), lgaml(), logl(), expl(), gammal(), sinl();
     942+long double fabsl(), lgammal(), logl(), expl(), tgammal(), sinl();
     943 long double floorl(), powl(), polevll(), p1evll(), isnanl(), isfinitel();
     944 static long double stirf();
     945 #endif
     946@@ -403,13 +398,13 @@
     947 
     948 
     949 
     950-long double gammal(x)
     951+long double tgammal(x)
     952 long double x;
     953 {
     954 long double p, q, z;
     955 int i;
     956+int signgam = 1;
     957 
     958-sgngaml = 1;
     959 #ifdef NANS
     960 if( isnanl(x) )
     961        return(NANL);
     962@@ -435,7 +430,7 @@
     963                        {
     964 gamnan:
     965 #ifdef NANS
     966-                       mtherr( "gammal", DOMAIN );
     967+                       mtherr( "tgammal", DOMAIN );
     968                        return (NANL);
     969 #else
     970                        goto goverf;
     971@@ -443,7 +438,7 @@
     972                        }
     973                i = p;
     974                if( (i & 1) == 0 )
     975-                       sgngaml = -1;
     976+                       signgam = -1;
     977                z = q - p;
     978                if( z > 0.5L )
     979                        {
     980@@ -456,10 +451,10 @@
     981                        {
     982 goverf:
     983 #ifdef INFINITIES
     984-                       return( sgngaml * INFINITYL);
     985+                       return( signgam * INFINITYL);
     986 #else
     987-                       mtherr( "gammal", OVERFLOW );
     988-                       return( sgngaml * MAXNUML);
     989+                       mtherr( "tgammal", OVERFLOW );
     990+                       return( signgam * MAXNUML);
     991 #endif
     992                        }
     993                z = PIL/z;
     994@@ -468,7 +463,7 @@
     995                {
     996                z = stirf(x);
     997                }
     998-       return( sgngaml * z );
     999+       return( signgam * z );
     1000        }
     1001 
     1002 z = 1.0L;
     1003@@ -642,13 +637,13 @@
     1004 /* Logarithm of gamma function */
     1005 
     1006 
     1007-long double lgaml(x)
     1008+long double lgammal(x)
     1009 long double x;
     1010 {
     1011 long double p, q, w, z, f, nx;
     1012 int i;
     1013 
     1014-sgngaml = 1;
     1015+signgam = 1;
     1016 #ifdef NANS
     1017 if( isnanl(x) )
     1018        return(NANL);
     1019@@ -660,12 +655,12 @@
     1020 if( x < -34.0L )
     1021        {
     1022        q = -x;
     1023-       w = lgaml(q); /* note this modifies sgngam! */
     1024+       w = lgammal(q); /* note this modifies signgam! */
     1025        p = floorl(q);
     1026        if( p == q )
     1027                {
     1028 #ifdef INFINITIES
     1029-               mtherr( "lgaml", SING );
     1030+               mtherr( "lgammal", SING );
     1031                return (INFINITYL);
     1032 #else
     1033                goto loverf;
     1034@@ -673,9 +668,9 @@
     1035                }
     1036        i = p;
     1037        if( (i & 1) == 0 )
     1038-               sgngaml = -1;
     1039+               signgam = -1;
     1040        else
     1041-               sgngaml = 1;
     1042+               signgam = 1;
     1043        z = q - p;
     1044        if( z > 0.5L )
     1045                {
     1046@@ -711,11 +706,11 @@
     1047                }
     1048        if( z < 0.0L )
     1049                {
     1050-               sgngaml = -1;
     1051+               signgam = -1;
     1052                z = -z;
     1053                }
     1054        else
     1055-               sgngaml = 1;
     1056+               signgam = 1;
     1057        if( x == 2.0L )
     1058                return( logl(z) );
     1059        x = (nx - 2.0L) + f;
     1060@@ -727,10 +722,10 @@
     1061        {
     1062 loverf:
     1063 #ifdef INFINITIES
     1064-       return( sgngaml * INFINITYL );
     1065+       return( signgam * INFINITYL );
     1066 #else
     1067-       mtherr( "lgaml", OVERFLOW );
     1068-       return( sgngaml * MAXNUML );
     1069+       mtherr( "lgammal", OVERFLOW );
     1070+       return( signgam * MAXNUML );
     1071 #endif
     1072        }
     1073 
     1074@@ -754,11 +749,11 @@
     1075        q = z / (x * polevll( x, S, 8 ));
     1076 if( q < 0.0L )
     1077        {
     1078-       sgngaml = -1;
     1079+       signgam = -1;
     1080        q = -q;
     1081        }
     1082 else
     1083-       sgngaml = 1;
     1084+       signgam = 1;
     1085 q = logl( q );
     1086 return(q);
     1087 }
     1088diff -drNu src.orig/ldouble/makefile src/ldouble/makefile
     1089--- src.orig/ldouble/makefile   2010-04-06 11:46:28.000000000 +0200
     1090+++ src/ldouble/makefile        2013-01-08 15:07:41.399639696 +0100
     1091@@ -12,11 +12,11 @@
     1092 exp10l.o exp2l.o expl.o fdtrl.o gammal.o gdtrl.o igamil.o igaml.o \
     1093 incbetl.o incbil.o isnanl.o j0l.o j1l.o jnl.o ldrand.o log10l.o log2l.o \
     1094 logl.o nbdtrl.o ndtril.o ndtrl.o pdtrl.o powl.o powil.o sinhl.o sinl.o \
     1095-sqrtl.o stdtrl.o tanhl.o tanl.o unityl.o ynl.o \
     1096+sqrtl.o stdtrl.o tanhl.o tanl.o ynl.o \
     1097 floorl.o polevll.o unityl.o mtherr.o
     1098 # cmplxl.o clogl.o
     1099 
     1100-all: mtstl lparanoi lcalc fltestl nantst testvect monotl libml.a
     1101+all: mtstl lcalc fltestl nantst testvect monotl libml.a
     1102 
     1103 mtstl: libml.a mtstl.o $(OBJS)
     1104        $(CC) $(CFLAGS) -o mtstl mtstl.o libml.a $(LIBS)
     1105@@ -59,10 +59,10 @@
     1106 # ELF versions for linux
     1107 #floorl.o: floorlelf.387
     1108 #      as -o floorl.o floorlelf.387
     1109-sqrtl.o: sqrtlelf.387
     1110-       as -o sqrtl.o sqrtlelf.387
     1111-setprec.o: setprelf.387
     1112-       as -o setprec.o setprelf.387
     1113+#sqrtl.o: sqrtlelf.387
     1114+#      as -o sqrtl.o sqrtlelf.387
     1115+#setprec.o: setprelf.387
     1116+#      as -o setprec.o setprelf.387
     1117 
     1118 # 68K routines
     1119 # For Sun 3
     1120diff -drNu src.orig/Makefile src/Makefile
     1121--- src.orig/Makefile   1970-01-01 01:00:00.000000000 +0100
     1122+++ src/Makefile        2013-01-08 15:08:01.743638992 +0100
     1123@@ -0,0 +1,68 @@
     1124+# FreeBSD makefile for cephes.
     1125+
     1126+# Build tools
     1127+CC ?= gcc
     1128+LD ?= ld
     1129+CP ?= cp
     1130+INSTALL ?= install
     1131+
     1132+# Intermediate (ar) libraries
     1133+LIBS=c9x-complex/libmc.a double/libmd.a ldouble/libml.a single/libmf.a
     1134+
     1135+all: libm.so
     1136+
     1137+install: libm.so complex.h math.h
     1138+       ${INSTALL} -C -m 644 complex.h math.h "${SAGE_LOCAL}/include"
     1139+       ${INSTALL} -C -m 755 libm.so "${SAGE_LOCAL}/lib"
     1140+
     1141+check:
     1142+       cd c9x-complex && ${MAKE} "CC=${CC}" check
     1143+       cd double && ${MAKE} "CC=${CC}" check
     1144+       cd ldouble && ${MAKE} "CC=${CC}" check
     1145+       cd single && ${MAKE} "CC=${CC}" check
     1146+#      cd c9x-complex && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
     1147+#      cd double && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
     1148+#      cd ldouble && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
     1149+#      cd single && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
     1150+#      TBD
     1151+
     1152+clean:
     1153+       rm -f libm.so syms.c99 syms.libm syms.wanted
     1154+       cd c9x-complex && ${MAKE} clean
     1155+       cd double && ${MAKE} clean
     1156+       cd ldouble && ${MAKE} clean
     1157+       cd single && ${MAKE} clean
     1158+
     1159+# FreeBSD includes some but not all of the C99 maths functions.  Build
     1160+# a "new" libm.so that uses cephes functions to replace the missing ones
     1161+# (listed in syms.wanted) and then fallback to the base libm.so
     1162+libm.so: ${LIBS} syms.wanted
     1163+       ${LD} -shared -o $@ $$(sed 's/^/-u /' syms.wanted) -L/usr/lib -lc -lm \
     1164+          ${LIBS} -lgcc
     1165+
     1166+# List of symbols defined in the FreeBSD base libc.so and libm.so
     1167+# libc.so is included because some math-related functions are in libc.so
     1168+syms.libm: /usr/lib/libc.so /usr/lib/libm.so
     1169+       nm -Dgp $^ | sed 's/^.* //' | sort -uo $@
     1170+
     1171+# List of symbols defined in C99 math.h and complex.h
     1172+# Doing it this way saves having to maintain a second list
     1173+syms.c99: math.h complex.h
     1174+       sed -ne 's/)(.*//' -e '/^extern/s/^.* (//p' $^ | sort -uo $@
     1175+
     1176+# List of symbols in C99 not defined in FreeBSD
     1177+syms.wanted: syms.libm syms.c99
     1178+       comm -23 syms.c99 syms.libm > $@
     1179+
     1180+# Force compilation in PIC mode to allow creation of a shared library
     1181+c9x-complex/libmc.a: c9x-complex/complex.h
     1182+       cd c9x-complex && ${MAKE} "CC=${CC} -DPIC -fpic" libmc.a
     1183+
     1184+double/libmd.a:
     1185+       cd double && ${MAKE} "CC=${CC} -DPIC -fpic" libmd.a
     1186+
     1187+ldouble/libml.a:
     1188+       cd ldouble && ${MAKE} "CC=${CC} -DPIC -fpic" libml.a
     1189+
     1190+single/libmf.a:
     1191+       cd single && ${MAKE} "CC=${CC} -DPIC -fpic" libmf.a
     1192diff -drNu src.orig/math.h src/math.h
     1193--- src.orig/math.h     1970-01-01 01:00:00.000000000 +0100
     1194+++ src/math.h  2013-01-08 15:07:41.407639759 +0100
     1195@@ -0,0 +1,201 @@
     1196+/*
     1197+** Replacement <math.h> merging host version with cephes functions
     1198+*/
     1199+
     1200+/* Start by using host math file.
     1201+ * This has to come before the following protective #ifdef so that
     1202+ * #include "math.h" is correctly handled. */
     1203+#include_next <math.h>
     1204+
     1205+#ifndef __CEPHES_MATH_H
     1206+#define __CEPHES_MATH_H
     1207+
     1208+#if defined(__cplusplus)
     1209+extern "C" {
     1210+#endif
     1211+
     1212+/* The following content is derived from
     1213+ * http://www.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html
     1214+ */
     1215+extern double      (acos)(double);
     1216+extern float       (acosf)(float);
     1217+extern double      (acosh)(double);
     1218+extern float       (acoshf)(float);
     1219+extern long double (acoshl)(long double);
     1220+extern long double (acosl)(long double);
     1221+extern double      (asin)(double);
     1222+extern float       (asinf)(float);
     1223+extern double      (asinh)(double);
     1224+extern float       (asinhf)(float);
     1225+extern long double (asinhl)(long double);
     1226+extern long double (asinl)(long double);
     1227+extern double      (atan)(double);
     1228+extern double      (atan2)(double, double);
     1229+extern float       (atan2f)(float, float);
     1230+extern long double (atan2l)(long double, long double);
     1231+extern float       (atanf)(float);
     1232+extern double      (atanh)(double);
     1233+extern float       (atanhf)(float);
     1234+extern long double (atanhl)(long double);
     1235+extern long double (atanl)(long double);
     1236+extern double      (cbrt)(double);
     1237+extern float       (cbrtf)(float);
     1238+extern long double (cbrtl)(long double);
     1239+extern double      (ceil)(double);
     1240+extern float       (ceilf)(float);
     1241+extern long double (ceill)(long double);
     1242+extern double      (copysign)(double, double);
     1243+extern float       (copysignf)(float, float);
     1244+extern long double (copysignl)(long double, long double);
     1245+extern double      (cos)(double);
     1246+extern float       (cosf)(float);
     1247+extern double      (cosh)(double);
     1248+extern float       (coshf)(float);
     1249+extern long double (coshl)(long double);
     1250+extern long double (cosl)(long double);
     1251+extern double      (erf)(double);
     1252+extern double      (erfc)(double);
     1253+extern float       (erfcf)(float);
     1254+extern long double (erfcl)(long double);
     1255+extern float       (erff)(float);
     1256+extern long double (erfl)(long double);
     1257+extern double      (exp)(double);
     1258+extern double      (exp2)(double);
     1259+extern float       (exp2f)(float);
     1260+extern long double (exp2l)(long double);
     1261+extern float       (expf)(float);
     1262+extern long double (expl)(long double);
     1263+extern double      (expm1)(double);
     1264+extern float       (expm1f)(float);
     1265+extern long double (expm1l)(long double);
     1266+extern double      (fabs)(double);
     1267+extern float       (fabsf)(float);
     1268+extern long double (fabsl)(long double);
     1269+extern double      (fdim)(double, double);
     1270+extern float       (fdimf)(float, float);
     1271+extern long double (fdiml)(long double, long double);
     1272+extern double      (floor)(double);
     1273+extern float       (floorf)(float);
     1274+extern long double (floorl)(long double);
     1275+extern double      (fma)(double, double, double);
     1276+extern float       (fmaf)(float, float, float);
     1277+extern long double (fmal)(long double, long double, long double);
     1278+extern double      (fmax)(double, double);
     1279+extern float       (fmaxf)(float, float);
     1280+extern long double (fmaxl)(long double, long double);
     1281+extern double      (fmin)(double, double);
     1282+extern float       (fminf)(float, float);
     1283+extern long double (fminl)(long double, long double);
     1284+extern double      (fmod)(double, double);
     1285+extern float       (fmodf)(float, float);
     1286+extern long double (fmodl)(long double, long double);
     1287+extern double      (frexp)(double, int *);
     1288+extern float       (frexpf)(float, int *);
     1289+extern long double (frexpl)(long double, int *);
     1290+extern double      (hypot)(double, double);
     1291+extern float       (hypotf)(float, float);
     1292+extern long double (hypotl)(long double, long double);
     1293+extern int         (ilogb)(double);
     1294+extern int         (ilogbf)(float);
     1295+extern int         (ilogbl)(long double);
     1296+extern double      (j0)(double);               /* XSI extension */
     1297+extern double      (j1)(double);               /* XSI extension */
     1298+extern double      (jn)(int, double);          /* XSI extension */
     1299+extern double      (ldexp)(double, int);
     1300+extern float       (ldexpf)(float, int);
     1301+extern long double (ldexpl)(long double, int);
     1302+extern double      (lgamma)(double);
     1303+extern float       (lgammaf)(float);
     1304+extern long double (lgammal)(long double);
     1305+extern long long   (llrint)(double);
     1306+extern long long   (llrintf)(float);
     1307+extern long long   (llrintl)(long double);
     1308+extern long long   (llround)(double);
     1309+extern long long   (llroundf)(float);
     1310+extern long long   (llroundl)(long double);
     1311+extern double      (log)(double);
     1312+extern double      (log10)(double);
     1313+extern float       (log10f)(float);
     1314+extern long double (log10l)(long double);
     1315+extern double      (log1p)(double);
     1316+extern float       (log1pf)(float);
     1317+extern long double (log1pl)(long double);
     1318+extern double      (log2)(double);
     1319+extern float       (log2f)(float);
     1320+extern long double (log2l)(long double);
     1321+extern double      (logb)(double);
     1322+extern float       (logbf)(float);
     1323+extern long double (logbl)(long double);
     1324+extern float       (logf)(float);
     1325+extern long double (logl)(long double);
     1326+extern long        (lrint)(double);
     1327+extern long        (lrintf)(float);
     1328+extern long        (lrintl)(long double);
     1329+extern long        (lround)(double);
     1330+extern long        (lroundf)(float);
     1331+extern long        (lroundl)(long double);
     1332+extern double      (modf)(double, double *);
     1333+extern float       (modff)(float, float *);
     1334+extern long double (modfl)(long double, long double *);
     1335+extern double      (nan)(const char *);
     1336+extern float       (nanf)(const char *);
     1337+extern long double (nanl)(const char *);
     1338+extern double      (nearbyint)(double);
     1339+extern float       (nearbyintf)(float);
     1340+extern long double (nearbyintl)(long double);
     1341+extern double      (nextafter)(double, double);
     1342+extern float       (nextafterf)(float, float);
     1343+extern long double (nextafterl)(long double, long double);
     1344+extern double      (nexttoward)(double, long double);
     1345+extern float       (nexttowardf)(float, long double);
     1346+extern long double (nexttowardl)(long double, long double);
     1347+extern double      (pow)(double, double);
     1348+extern float       (powf)(float, float);
     1349+extern long double (powl)(long double, long double);
     1350+extern double      (remainder)(double, double);
     1351+extern float       (remainderf)(float, float);
     1352+extern long double (remainderl)(long double, long double);
     1353+extern double      (remquo)(double, double, int *);
     1354+extern float       (remquof)(float, float, int *);
     1355+extern long double (remquol)(long double, long double, int *);
     1356+extern double      (rint)(double);
     1357+extern float       (rintf)(float);
     1358+extern long double (rintl)(long double);
     1359+extern double      (round)(double);
     1360+extern float       (roundf)(float);
     1361+extern long double (roundl)(long double);
     1362+extern double      (scalbln)(double, long);
     1363+extern float       (scalblnf)(float, long);
     1364+extern long double (scalblnl)(long double, long);
     1365+extern double      (scalbn)(double, int);
     1366+extern float       (scalbnf)(float, int);
     1367+extern long double (scalbnl)(long double, int);
     1368+extern double      (sin)(double);
     1369+extern float       (sinf)(float);
     1370+extern double      (sinh)(double);
     1371+extern float       (sinhf)(float);
     1372+extern long double (sinhl)(long double);
     1373+extern long double (sinl)(long double);
     1374+extern double      (sqrt)(double);
     1375+extern float       (sqrtf)(float);
     1376+extern long double (sqrtl)(long double);
     1377+extern double      (tan)(double);
     1378+extern float       (tanf)(float);
     1379+extern double      (tanh)(double);
     1380+extern float       (tanhf)(float);
     1381+extern long double (tanhl)(long double);
     1382+extern long double (tanl)(long double);
     1383+extern double      (tgamma)(double);
     1384+extern float       (tgammaf)(float);
     1385+extern long double (tgammal)(long double);
     1386+extern double      (trunc)(double);
     1387+extern float       (truncf)(float);
     1388+extern long double (truncl)(long double);
     1389+extern double      (y0)(double);               /* XSI extension */
     1390+extern double      (y1)(double);               /* XSI extension */
     1391+extern double      (yn)(int, double);  /* XSI extension */
     1392+
     1393+#if defined(__cplusplus)
     1394+}
     1395+#endif
  • deleted file patches/c9x-complex/cgamma.c

    ++#endif
    diff --git a/patches/c9x-complex/cgamma.c b/patches/c9x-complex/cgamma.c
    deleted file mode 100644
    + -  
    1 /*                                                      cgamma
    2  *
    3  *      Complex gamma function
    4  *
    5  *
    6  *
    7  * SYNOPSIS:
    8  *
    9  * #include <complex.h>
    10  * double complex x, y, cgamma();
    11  *
    12  * y = cgamma( x );
    13  *
    14  *
    15  *
    16  * DESCRIPTION:
    17  *
    18  * Returns complex-valued gamma function of the complex argument.
    19  * This variable is also filled in by the logarithmic gamma
    20  * function clgam().
    21  *
    22  * Arguments |x| < 18 are increased by recurrence.
    23  * Large arguments are handled by Stirling's formula. Large negative
    24  * arguments are made positive using the reflection formula. 
    25  *
    26  *
    27  * ACCURACY:
    28  *
    29  *                      Relative error:
    30  * arithmetic   domain     # trials      peak         rms
    31  *    IEEE      -20,20      500000      2.0e-14     2.7e-15
    32  *    IEEE     -100,100     100000      1.4e-13     1.5e-14
    33  *
    34  * Error for arguments outside the test range will be larger
    35  * owing to error amplification by the exponential function.
    36  *
    37  */
    380
    39 /*                                                      clgam
    40  *
    41  *      Natural logarithm of complex gamma function
    42  *
    43  *
    44  *
    45  * SYNOPSIS:
    46  *
    47  * #include <complex.h>
    48  * double complex x, y, clgam();
    49  *
    50  * y = clgam( x );
    51  *
    52  *
    53  *
    54  * DESCRIPTION:
    55  *
    56  * Returns the base e (2.718...) logarithm of the complex gamma
    57  * function of the argument.
    58  *
    59  * The logarithm of the gamma function is approximated by the
    60  * logarithmic version of Stirling's asymptotic formula.
    61  * Arguments of real part less than 14 are increased by recurrence.
    62  * The cosecant reflection formula is employed for arguments
    63  * having real part less than -14.
    64  *
    65  * Arguments greater than MAXLGM return MAXNUM and an error
    66  * message.  MAXLGM = 2.556348e305 for IEEE arithmetic.
    67  *
    68  *
    69  *
    70  * ACCURACY:
    71  *
    72  *
    73  * arithmetic   domain     # trials      peak         rms
    74  *    IEEE      -20,20      500000      1.4e-14     4.5e-16
    75  *    IEEE     -100,100     100000                  1.6e-16
    76  * The error criterion was relative when the function magnitude
    77  * was greater than one but absolute when it was less than one.
    78  */
    79 
    801
    81 /*
    82 Cephes Math Library Release 2.7:  March, 1998
    83 Copyright 1984, 1998 Stephen L. Moshier
    84 */
    85 
    86 #include <complex.h>
    87 #include "mconf.h"
    88 
    89 #define MAXGAM 171.624376956302725
    90 static double LOGPI = 1.14472988584940017414;
    91 
    92 /* Stirling's formula for the gamma function */
    93 #define NSTIR 7
    94 static double STIR[ NSTIR ] = {
    95 #if 0
    96  7.20489541602001055909E-5,
    97  8.39498720672087279993E-4,
    98 -5.17179090826059219337E-5,
    99 #endif
    100 -5.92166437353693882865E-4,
    101  6.97281375836585777429E-5,
    102  7.84039221720066627474E-4,
    103 -2.29472093621399176955E-4,
    104 -2.68132716049382716049E-3,
    105  3.47222222222222222222E-3,
    106  8.33333333333333333333E-2
    107 };
    108 #define MAXSTIR 143.01608
    109 static double SQTPI = 2.50662827463100050242E0;
    110 
    111 extern double MAXLOG, MAXNUM, PI;
    112 #ifndef ANSIPROT
    113 double log(), sin(), polevl(), p1evl(), floor(), fabs();
    114 double complex cpow(), cexp(), cabs();
    115 #endif
    116 
    117 /* Gamma function computed by Stirling's formula.  */
    118 
    119 /* static double complex cstirf(x) */
    120 double complex cstirf(x)
    121 double complex x;
    122 {
    123 double complex y, w;
    124 int i;
    125 
    126 w = 1.0/x;
    127 
    128 y = STIR[0];
    129 for (i = 1; i < NSTIR; i++)
    130   {
    131     y = y * w + STIR[i];
    132   }
    133 
    134 w = 1.0 + w * y;
    135 #if 1
    136 y = cpow( x, x - 0.5 ) * cexp(-x);
    137 #else
    138 y = (x - 0.5) * clog(x) - x;
    139 y = cexp(y);
    140 #endif
    141 y = SQTPI * y * w;
    142 return( y );
    143 }
    144 
    145 
    146 
    147 double complex cgamma(x)
    148 double complex x;
    149 {
    150 double p, q;
    151 double complex c, u;
    152 
    153 if (fabs(creal(x)) > 18.0)
    154         {
    155         if( creal(x) < 0.0 )
    156                 {
    157                 q = creal(x);
    158                 p = floor(q);
    159                 if( p == q )
    160                         {
    161                         mtherr( "cgamma", OVERFLOW );
    162                         return( MAXNUM + I * MAXNUM);
    163                         }
    164                 c = csin( PI * (x - p) );
    165                 c = PI/(c * cgamma(1.0 - x) );
    166                 }
    167         else
    168                 {
    169                 c = cstirf(x);
    170                 }
    171         return( c );
    172         }
    173 
    174 c = 1.0;
    175 p = 0.0;
    176 u = x;
    177 while( creal(u) < 18.0 )
    178         {
    179         if( fabs (creal(u)) < 1.e-9 )
    180                 goto small;
    181         c *= u;
    182         p += 1.0;
    183         u = x + p;
    184         }
    185 u = cstirf(u);
    186 return( u / c );
    187 
    188 
    189 small:
    190 if( creal(x) == 0.0 )
    191         {
    192         mtherr( "cgamma", SING );
    193         return( MAXNUM + MAXNUM * I );
    194         }
    195 else
    196         return( 1.0/(((1.0 + 0.5772156649015329 * u) * u)*c) );
    197 }
    198 
    199 
    200 
    201 /* Asymptotic expansion of log gamma  */
    202 static double A[] = {
    203 #if 0
    204 -1.3924322169059011164274322169059011164274E0,
    205  1.7964437236883057316493849001588939669435E-1,
    206 -2.9550653594771241830065359477124183006536E-2,
    207  6.4102564102564102564102564102564102564103E-3,
    208 #endif
    209 -1.9175269175269175269175269175269175269175E-3,
    210  8.4175084175084175084175084175084175084175E-4,
    211 -5.9523809523809523809523809523809523809524E-4,
    212  7.9365079365079365079365079365079365079365E-4,
    213 -2.7777777777777777777777777777777777777778E-3,
    214  8.3333333333333333333333333333333333333333E-2
    215 };
    216 /* log( sqrt( 2*pi ) ) */
    217 static double LS2PI  =  0.91893853320467274178;
    218 #define MAXLGM 2.556348e305
    219 
    220 
    221 
    222 /* Logarithm of gamma function */
    223 
    224 double complex clgam(x)
    225 double complex x;
    226 {
    227 double p, q, a;
    228 double complex c, w, u, v;
    229 int i, cj;
    230 
    231 cj = 0;
    232 if (cimag(x) < 0)
    233   {
    234     cj = 1;
    235     x = conj(x);
    236   }
    237 
    238 /* Reflection formula -z gamma(-z) gamma(z) = pi / sin(pi z) */
    239 if( creal(x) < -14.0 )
    240         {
    241         q = creal(x);
    242         p = floor(q);
    243         if( p == q )
    244                 goto loverf;
    245         if (fabs(cimag(x)) > 36.7)
    246           {
    247             /* sin z grows exponentially with Im(z).  Find ln sin(pi z)
    248                from |sin z| = sqrt( sin^2 x + sinh^2 y),
    249                arg sin z = arctan(tanh y / tan x).  */
    250             c = PI * cimag(x) - 0.6931471805599453094
    251               + I * PI * (0.5 - q);
    252             c = LOGPI - c - clgam(1.0 - x);
    253           }
    254         else
    255           {
    256             /* Reduce sine arg mod pi.  */
    257             u = csin( PI * (x - p) );
    258             if( u == 0.0 )
    259               goto loverf;
    260             w = clgam(1.0 - x);
    261             c = LOGPI - clog( u ) - w;
    262             /* Adjust for reduced sine arg.  */
    263             (double)(__imag__ c = (cimag(c) + PI * p));
    264           }
    265         goto ldone;
    266         }
    267 w = 0.0;
    268 if(creal(x) < 14.0 )
    269         {
    270           /* To satisfy Im {clgam(z)} = arg cgamma(z), accumulate
    271              arg u during the recurrence.  */
    272           a = 0.0;
    273           w = 1.0;
    274           p = 0.0;
    275           u = x;
    276           while( creal(u) < 14.0 )
    277                 {
    278                 if( u == 0.0 )
    279                         goto loverf;
    280                 w *= u;
    281                 a += carg(u);
    282                 p += 1.0;
    283                 u = x + p;
    284                 }
    285         x = u;
    286         w = -log(cabs(w)) - I * a;
    287         }
    288 
    289 if( creal(x) > MAXLGM )
    290         {
    291 loverf:
    292         mtherr( "clgam", OVERFLOW );
    293         c = MAXNUM + MAXNUM * I;
    294         goto ldone;
    295         }
    296 
    297 c = ( x - 0.5 ) * clog(x) - x + LS2PI + w;
    298 
    299 if( cabs(x) > 1.0e8 )
    300   goto ldone;
    301 
    302 v = 1.0/(x*x);
    303 u = A[0];
    304 for (i = 1; i < 6; i++)
    305   {
    306     u = u * v + A[i];
    307   }
    308 c = c + u / x;
    309 
    310 ldone:
    311 if (cj)
    312   c = conj(c);
  • deleted file patches/c9x-complex/cgammac.patch

    -return( c );
    -}
    diff --git a/patches/c9x-complex/cgammac.patch b/patches/c9x-complex/cgammac.patch
    deleted file mode 100644
    + -  
    1 --- ../../src/c9x-complex/cgamma.c      2010-04-06 02:46:28.000000000 -0700
    2 +++ cgamma.c    2010-04-06 02:47:00.000000000 -0700
    3 @@ -258,7 +258,7 @@
    4             w = clgam(1.0 - x);
    5             c = LOGPI - clog( u ) - w;
    6             /* Adjust for reduced sine arg.  */
    7 -           cimag(c) += PI * p;
    8 +           (double)(__imag__ c = (cimag(c) + PI * p));
    9           }
    10         goto ldone;
    11         }
  • deleted file patches/c9x-complex/cgammaf.c

    diff --git a/patches/c9x-complex/cgammaf.c b/patches/c9x-complex/cgammaf.c
    deleted file mode 100644
    + -  
    1 /*                                                      cgammaf
    2  *
    3  *      Complex gamma function, single precision
    4  *
    5  *
    6  *
    7  * SYNOPSIS:
    8  *
    9  * #include <complex.h>
    10  * float complex x, y, cgammaf();
    11  *
    12  * y = cgammaf( x );
    13  *
    14  *
    15  *
    16  * DESCRIPTION:
    17  *
    18  * Returns complex-valued gamma function of the complex argument.
    19  *
    20  * Arguments |Re(x)| <= 14 are increased by recurrence.
    21  * Large arguments are handled by Stirling's formula. Large negative
    22  * arguments are made positive using the reflection formula. 
    23  *
    24  *
    25  * ACCURACY:
    26  *
    27  *                      Relative error:
    28  * arithmetic   domain     # trials      peak         rms
    29  *    IEEE      -10,10      100000      5.2e-6      5.8e-7
    30  *    IEEE      -22,22      100000      1.1e-5      1.2e-6
    31  *    IEEE      -27,27      100000      4.6e-5      1.5e-6
    32  *
    33  * Error for arguments outside the test range will be larger
    34  * owing to error amplification by the exponential function.
    35  *
    36  */
    370
    38 /*                                                      clgamf
    39  *
    40  *      Natural logarithm of complex gamma function, single precision
    41  *
    42  *
    43  *
    44  * SYNOPSIS:
    45  *
    46  * #include <complex.h>
    47  * float complex x, y, clgamf();
    48  *
    49  * y = clgamf( x );
    50  *
    51  *
    52  *
    53  * DESCRIPTION:
    54  *
    55  * Returns the base e (2.718...) logarithm of the complex gamma
    56  * function of the argument.
    57  *
    58  * The logarithm of the gamma function is approximated by the
    59  * logarithmic version of Stirling's asymptotic formula.
    60  * Arguments of real part less than 8 are increased by recurrence.
    61  * The cosecant reflection formula is employed for arguments
    62  * having real part less than -8.
    63  *
    64  * Arguments greater than MAXLGM return MAXNUM and an error
    65  * message.  MAXLGM = 2.035093e36.
    66  *
    67  *
    68  *
    69  * ACCURACY:
    70  *
    71  *
    72  * arithmetic   domain     # trials      peak         rms
    73  *    IEEE      -20,20     9 000 000    2.6e-6       1.1e-7
    74  *    IEEE     -100,100      500 000                 7.5e-8
    75  * The error criterion was relative when the function magnitude
    76  * was greater than one but absolute when it was less than one.
    77  */
    78 
    791
    80 /*
    81 Cephes Math Library Release 2.7:  March, 1998
    82 Copyright 1984, 1998 Stephen L. Moshier
    83 */
    84 
    85 #include "complex.h"
    86 #include "mconf.h"
    87 
    88 #define MAXGAM 171.624376956302725
    89 static float LOGPI = 1.14472988584940017414f;
    90 
    91 /* Stirling's formula for the gamma function */
    92 #define NSTIR 7
    93 static float STIR[ NSTIR ] = {
    94  -5.92166437353693882865E-4,
    95  6.97281375836585777429E-5,
    96  7.84039221720066627474E-4,
    97 -2.29472093621399176955E-4,
    98 -2.68132716049382716049E-3,
    99  3.47222222222222222222E-3,
    100  8.33333333333333333333E-2
    101 };
    102 #define MAXSTIR 26.0
    103 static float SQTPI = 2.50662827463100050242f;
    104 
    105 extern float MAXLOGF, MAXNUMF, PIF;
    106 #ifdef ANSIPROT
    107 extern float sinhf ( float x );
    108 extern float coshf ( float x );
    109 extern float sinf ( float x );
    110 extern float cosf ( float x );
    111 #else
    112 float logf(), sinf(), polevlf(), p1evlf(), floorf(), fabsf();
    113 float cosf(), sinhf(), coshf();
    114 float complex cpowf(), cexpf(), cabsf();
    115 #endif
    116 
    117 /* Gamma function computed by Stirling's formula.  */
    118 
    119 static float complex cstirf(x)
    120 float complex x;
    121 {
    122 float complex y, v, w;
    123 int i;
    124 
    125 w = 1.0f/x;
    126 
    127 y = STIR[0];
    128 for (i = 1; i < NSTIR; i++)
    129   {
    130     y = y * w + STIR[i];
    131   }
    132 
    133 w = 1.0f + w * y;
    134 if( cabsf(x) > MAXSTIR )
    135         { /* Avoid overflow in pow() */
    136         v = cpowf( x, 0.5f * x - 0.25f );
    137         y = v * (v * cexpf(-x));
    138         }
    139 else
    140         {
    141         y = cpowf( x, x - 0.5f ) * cexpf(-x);
    142         }
    143 /* y = cpowf( x, x - 0.5f ) * cexpf(-x); */
    144 
    145 y = SQTPI * y * w;
    146 return( y );
    147 }
    148 
    149 
    150 
    151 float complex cgammaf(x)
    152 float complex x;
    153 {
    154 float p, q;
    155 float complex c, u;
    156 int k;
    157 
    158 if( fabsf(crealf(x)) > 13.0f )
    159         {
    160         if( crealf(x) < 0.0f )
    161                 {
    162                 q = crealf(x);
    163                 p = floorf(q);
    164                 if((p == q ) && (cimag(x) == 0.0f))
    165                         {
    166 cgoverf:
    167                         mtherr( "cgammaf", OVERFLOW );
    168                         return( MAXNUMF + I * MAXNUMF);
    169                         }
    170                 /* Compute sin(pi x)  */
    171                 k = q - 2.0f * floorf (0.5f * q);
    172                 q = PIF * (q - p);
    173                 p = PIF * cimag(x);
    174                 c = sinf(q) * coshf(p) + cosf(q) * sinhf(p) * I;
    175                 if (k & 1)
    176                   c = -c;
    177                 /* Reflection formula.
    178                    ??? The denominator has been observed to overflow,
    179                    producing a NaN result on a SPARCstation instead of zero.
    180                    Example:
    181                    cgammaf(-19.425196335160404f - 18.188121066880587f*I) */
    182                 c = PIF/(c * cgammaf(1.0f - x));
    183                 }
    184         else
    185                 {
    186                 c = cstirf(x);
    187                 }
    188         return( c );
    189         }
    190 
    191 c = 1.0f;
    192 p = 0.0f;
    193 u = x;
    194 while( crealf(u) < 13.0f )
    195         {
    196         if ((crealf(u) == 0.0f) && (cimagf(u) == 0.0f))
    197                 goto cgoverf;
    198         c *= u;
    199         p += 1.0f;
    200         u = x + p;
    201         }
    202 u = cstirf(u);
    203 return( u / c );
    204 }
    205 
    206 
    207 
    208 /* Asymptotic expansion of log gamma  */
    209 static float A[] = {
    210 #if 0
    211 -1.3924322169059011164274322169059011164274E0,
    212  1.7964437236883057316493849001588939669435E-1,
    213 -2.9550653594771241830065359477124183006536E-2,
    214  6.4102564102564102564102564102564102564103E-3,
    215 -1.9175269175269175269175269175269175269175E-3,
    216  8.4175084175084175084175084175084175084175E-4,
    217 #endif
    218 -5.9523809523809523809523809523809523809524E-4,
    219  7.9365079365079365079365079365079365079365E-4,
    220 -2.7777777777777777777777777777777777777778E-3,
    221  8.3333333333333333333333333333333333333333E-2
    222 };
    223 /* log( sqrt( 2*pi ) ) */
    224 static float LS2PI  =  0.91893853320467274178f;
    225 #define MAXLGM 2.035093e36f
    226 
    227 
    228 
    229 /* Logarithm of gamma function */
    230 
    231 float complex clgamf(x)
    232 float complex x;
    233 {
    234 float complex c, w, u, v;
    235 float p, q, a;
    236 int i, cj;
    237 
    238 cj = 0;
    239 if (cimagf(x) < 0)
    240   {
    241     cj = 1;
    242     x = conj(x);
    243   }
    244 
    245 /* Reflection formula -z gamma(-z) gamma(z) = pi / sin(pi z)  */
    246 if((crealf(x) < -7.0f) || (cimagf(x) < -7.0f))
    247         {
    248         q = crealf(x);
    249         p = floorf(q);
    250         if( p == q )
    251                 goto loverf;
    252         if (fabsf(cimag(x)) > 18.4f)
    253           {
    254             /* sin z grows exponentially with Im(z).  Find ln sin(pi z)
    255                from |sin z| = sqrt( sin^2 x + sinh^2 y),
    256                arg sin z = arctan(tanh y / tan x).  */
    257             c = PIF * cimagf(x) - 0.6931471805599453094f
    258               + I * PIF * (0.5f - q);
    259             c = LOGPI - c - clgamf(1.0f - x);
    260           }
    261         else
    262           {
    263             /* Reduce sine arg mod pi.  */
    264             u = csinf( PIF * (x - p) );
    265             if( u == 0.0f )
    266               goto loverf;
    267             w = clgamf(1.0f - x);
    268             c = LOGPI - clogf( u ) - w;
    269             /* Adjust for reduced sine arg.  */
    270             //cimagf(c) += PIF * p;
    271             (float)(__imag__ c = (cimagf(c) + PIF * p));
    272           }
    273         goto ldone;
    274         }
    275 w = 0.0f;
    276 if( crealf(x) < 7.0f )
    277         {
    278           /* To satisfy Im {clgam(z)} = arg cgamma(z), accumulate
    279              arg u during the recurrence.  */
    280           a = 0.0f;
    281           w = 1.0f;
    282           p = 0.0f;
    283           u = x;
    284           while( crealf(u) < 7.0f )
    285                 {
    286                 if( u == 0.0f )
    287                         goto loverf;
    288                 w *= u;
    289                 a += cargf(u);
    290                 p += 1.0f;
    291                 u = x + p;
    292                 }
    293         x = u;
    294         w = -logf(cabsf(w)) - I * a;
    295         }
    296 
    297 if( crealf(x) > MAXLGM )
    298         {
    299 loverf:
    300         mtherr( "clgamf", OVERFLOW );
    301         c = MAXNUMF + MAXNUMF * I;
    302         goto ldone;
    303         }
    304 
    305 c = ( x - 0.5f ) * clogf(x) - x + LS2PI + w;
    306 
    307 if( cabsf(x) > 1.0e8f )
    308   goto ldone;
    309 
    310 v = 1.0f/(x*x);
    311 u = A[0];
    312 for (i = 1; i < 4; i++)
    313   {
    314     u = u * v + A[i];
    315   }
    316 c = c + u / x;
    317 
    318 ldone:
    319 if (cj)
    320   c = conj(c);
  • deleted file patches/c9x-complex/cgammaf.patch

    -return( c );
    -}
    diff --git a/patches/c9x-complex/cgammaf.patch b/patches/c9x-complex/cgammaf.patch
    deleted file mode 100644
    + -  
    1 --- ../src/cgammaf.c    2004-08-01 13:23:29.000000000 -0700
    2 +++ cgammaf.c   2010-02-15 23:05:28.478417600 -0800
    3 @@ -265,7 +265,8 @@
    4             w = clgamf(1.0f - x);
    5             c = LOGPI - clogf( u ) - w;
    6             /* Adjust for reduced sine arg.  */
    7 -           cimagf(c) += PIF * p;
    8 +           //cimagf(c) += PIF * p;
    9 +           (float)(__imag__ c = (cimagf(c) + PIF * p));
    10           }
    11         goto ldone;
    12         }
  • deleted file patches/c9x-complex/cgammal.c

    diff --git a/patches/c9x-complex/cgammal.c b/patches/c9x-complex/cgammal.c
    deleted file mode 100644
    + -  
    1 /*                                                      cgammal.c
    2  *
    3  *      Complex gamma function, long double precision
    4  *
    5  *
    6  *
    7  * SYNOPSIS:
    8  *
    9  * #include <complex.h>
    10  * long double complex x, y, cgammal();
    11  *
    12  * y = cgammal( x );
    13  *
    14  *
    15  *
    16  * DESCRIPTION:
    17  *
    18  * Returns complex-valued gamma function of the complex argument.
    19  *
    20  * Arguments |Re(x)| <= 20 are increased by recurrence.
    21  * Large arguments are handled by Stirling's formula. Large negative
    22  * arguments are made positive using the reflection formula. 
    23  *
    24  *
    25  * ACCURACY:
    26  *
    27  *                      Relative error:
    28  * arithmetic   domain     # trials      peak         rms
    29  * 80-bit long double:
    30  *    IEEE      -10,10       40000      4.1e-18     7.0e-19
    31  *    IEEE      -20,20       40000      9.1e-18     1.0e-18
    32  *    IEEE     -100,100      40000      5.9e-17     7.4e-18
    33  * 128-bit long double:
    34  *    IEEE      -10,10       30000      4.9e-32     8.7e-33
    35  *    IEEE     -100,100      45000      1.2e-31     1.7e-32
    36  *
    37  * Error for arguments outside the test range will be larger
    38  * owing to error amplification by the exponential function.
    39  *
    40  */
    410
    42 /*                                                      clgaml()
    43  *
    44  *      Natural logarithm of complex gamma function, long double precision
    45  *
    46  *
    47  *
    48  * SYNOPSIS:
    49  *
    50  * #include <complex.h>
    51  * long double complex x, y, clgaml();
    52  *
    53  * y = clgaml( x );
    54  *
    55  *
    56  *
    57  * DESCRIPTION:
    58  *
    59  * Returns the base e (2.718...) logarithm of the complex gamma
    60  * function of the complex argument.
    61  *
    62  * The logarithm of the gamma function is approximated by the
    63  * logarithmic version of Stirling's asymptotic formula.
    64  * Arguments of real part less than 16 are increased by recurrence.
    65  * The cosecant reflection formula is employed for arguments
    66  * having real part less than -16.5.
    67  *
    68  * Arguments greater than MAXLGM return MAXNUM and an error
    69  * message.  MAXLGM = 1.048e+4928L.
    70  *
    71  *
    72  *
    73  * ACCURACY:
    74  *
    75  *
    76  * arithmetic   domain     # trials      peak         rms
    77  * 80-bit long double:
    78  *    IEEE      -10,10       30000     7.9e-18      5.2e-19
    79  *    IEEE      -50,50       20000                  1.1e-19
    80  *    IEEE     -100,100      20000                  7.4e-20
    81  * 128-bit long double:
    82  *    IEEE      -10,10       21000     4.4e-32      3.6e-33
    83  *    IEEE     -100,100      23000                  4.4e-34
    84  * The error criterion was relative when the function magnitude
    85  * was greater than one but absolute when it was less than one.
    86  */
    87 
    881
    89 /*
    90 Cephes Math Library Release 2.7:  April, 1998
    91 Copyright 1998 Stephen L. Moshier
    92 */
    93 
    94 #include <complex.h>
    95 #include "mconf.h"
    96 
    97 #ifdef LD128BITS
    98 #define NGITER 50.0L
    99 #define NLGITER 50.0L
    100 #define LGMXINT 44.4L
    101 #define GSMALL 1.e-17L
    102 #else
    103 #define NGITER 20.0L
    104 #define NLGITER 16.0L
    105 #define LGMXINT 78.3L
    106 #define GSMALL 1.e-9L
    107 #endif
    108 
    109 #define MAXGAM  1755.455L
    110 static long double LOGPIL =  1.1447298858494001741434273513530587116473L;
    111 
    112 
    113 /* Stirling's formula for the gamma function */
    114 #define NSTIR 18
    115 static long double STIR[NSTIR] = {
    116  1.50561130400264244123842218771311273E-2L,
    117  1.79540117061234856107699407722226331E-1L,
    118 -2.48174360026499773091565836874346432E-3L,
    119 -2.95278809456991205054406510546938244E-2L,
    120  5.40164767892604515180467508570241736E-4L,
    121  6.40336283380806979482363809026579583E-3L,
    122 -1.62516262783915816898635123980270998E-4L,
    123 -1.91443849856547752650089885832852254E-3L,
    124  7.20489541602001055908571930225015052E-5L,
    125  8.39498720672087279993357516764983445E-4L,
    126 -5.17179090826059219337057843002058823E-5L,
    127 -5.92166437353693882864836225604401187E-4L,
    128  6.97281375836585777429398828575783308E-5L,
    129  7.84039221720066627474034881442288850E-4L,
    130 -2.29472093621399176954732510288065844E-4L,
    131 -2.68132716049382716049382716049382716E-3L,
    132  3.47222222222222222222222222222222222E-3L,
    133  8.33333333333333333333333333333333333E-2L,
    134 };
    135 #define MAXSTIR 1024.0L
    136 static long double SQTPIL = 2.50662827463100050241576528481104525L;
    137 
    138 extern long double MAXLOGL, MAXNUML, PIL;
    139 #ifdef ANSIPROT
    140 extern long double sinhl ( long double x );
    141 extern long double coshl ( long double x );
    142 extern long double sinl ( long double x );
    143 extern long double cosl ( long double x );
    144 #else
    145 long double logl(), sinl(), polevll(), p1evll(), floorl(), fabsl();
    146 long double sinhl(), coshl(), cosl();
    147 long double complex cpowl(), cexpl(), cabsl();
    148 #endif
    149 
    150 /* Gamma function computed by Stirling's formula.  */
    151 
    152 /* static double complex cstirf(x) */
    153 long double complex cstirfl(x)
    154 long double complex x;
    155 {
    156 long double complex y, w;
    157 int i;
    158 
    159 w = 1.0L/x;
    160 
    161 y = STIR[0];
    162 for (i = 1; i < NSTIR; i++)
    163   {
    164     y = y * w + STIR[i];
    165   }
    166 
    167 w = 1.0L + w * y;
    168 #if 1
    169 y = cpowl( x, x - 0.5L ) * cexpl(-x);
    170 #else
    171 y = (x - 0.5L) * clogl(x) - x;
    172 y = cexpl(y);
    173 #endif
    174 y = SQTPIL * y * w;
    175 return( y );
    176 }
    177 
    178 
    179 
    180 long double complex cgammal(x)
    181 long double complex x;
    182 {
    183 long double complex c, u;
    184 long double p, q;
    185 int cj, k;
    186 
    187 cj = 0;
    188 if (cimagl(x) < 0.0L)
    189   {
    190     cj = 1;
    191     x = conj(x);
    192   }
    193 
    194 if( fabsl(creall(x)) > NGITER )
    195         {
    196         if( creall(x) < 0.0L )
    197                 {
    198                 q = creall(x);
    199                 p = floorl(q);
    200                 if(( p == q ) && (cimagl(x) == 0.0L))
    201                         {
    202                         mtherr( "cgammal", OVERFLOW );
    203                         c = MAXNUML + I * MAXNUML;
    204                         goto gamdone;
    205                         }
    206                 /*      c = csinl( PIL * x );*/
    207                 /* Compute sin(pi x)  */
    208                 k = q - 2.0L * floorl (0.5L * q);
    209                 q = PIL * (q - p);
    210                 p = PIL * cimagl(x);
    211                 c = sinl(q) * coshl(p) + cosl(q) * sinhl(p) * I;
    212                 if (k & 1)
    213                   c = -c;
    214                 c = PIL/(c * cgammal(1.0L - x) );
    215                 goto gamdone;
    216                 }
    217         else
    218                 {
    219                   c = cstirfl(x);
    220                   goto gamdone;
    221                 }
    222         }
    223 c = 1.0L;
    224 p = 0.0L;
    225 u = x;
    226 while( creall(u) < NGITER )
    227         {
    228         if((fabsl (creall(u)) < GSMALL) && (fabsl (cimagl(u)) < GSMALL))
    229                 goto small;
    230         c *= u;
    231         p += 1.0L;
    232         u = x + p;
    233         }
    234 u = cstirfl(u);
    235 c = u / c;
    236 goto gamdone;
    237 
    238 
    239 small:
    240 if((creall(x) == 0.0L) && (cimagl(x) == 0.0L))
    241         {
    242         mtherr( "cgammal", SING );
    243         c = MAXNUML + MAXNUML * I;
    244         goto gamdone;
    245         }
    246 else
    247         c = 1.0L/(((1.0L + 0.57721566490153286060651209008240243L * u) * u)*c);
    248 
    249 gamdone:
    250 
    251 if (cj)
    252   c = conj(c);
    253 return( c );
    254 }
    255 
    256 
    257 /* Asymptotic expansion of log gamma  */
    258 #define NUMA 9
    259 static long double A[NUMA] = {
    260 #if 0
    261   1.3402864044168391994478951000690131124914E1L,
    262  -1.3924322169059011164274322169059011164274E0L,
    263 #endif
    264  1.7964437236883057316493849001588939669435E-1L,
    265 -2.9550653594771241830065359477124183006536E-2L,
    266  6.4102564102564102564102564102564102564103E-3L,
    267 -1.9175269175269175269175269175269175269175E-3L,
    268  8.4175084175084175084175084175084175084175E-4L,
    269 -5.9523809523809523809523809523809523809524E-4L,
    270  7.9365079365079365079365079365079365079365E-4L,
    271 -2.7777777777777777777777777777777777777778E-3L,
    272  8.3333333333333333333333333333333333333333E-2L
    273 };
    274 /* log( sqrt( 2*pi ) ) */
    275 static long double LS2PIL  =  0.918938533204672741780329736405617639861397L;
    276 #define MAXLGML 1.04848146839019521116e+4928L
    277 
    278 
    279 
    280 /* Logarithm of gamma function */
    281 
    282 long double complex clgaml(x)
    283 long double complex x;
    284 {
    285 long double complex c, w, u, v;
    286 long double p, q, a;
    287 int i, cj;
    288 
    289 cj = 0;
    290 if (cimagl(x) < 0.0L)
    291   {
    292     cj = 1;
    293     x = conj(x);
    294   }
    295 
    296 /* -z gamma(-z) gamma(z) = pi / sin(pi z) */
    297 /* log gamma(z) = log pi - log sin(pi z) - log(-z) - log gamma(-z) */
    298 if((creall(x) < -NLGITER) || (cimagl(x) < -NLGITER))
    299         {
    300         q = creall(x);
    301         p = floorl(q);
    302         if( p == q )
    303                 goto loverf;
    304         if (fabsl(cimagl(x)) > LGMXINT)
    305           {
    306             /* sin z grows exponentially with Im(z).  Find ln sin(pi z)
    307                from |sin z| = sqrt( sin^2 x + sinh^2 y),
    308                arg sin z = arctan(tanh y / tan x).  */
    309             c = PIL * cimagl(x) - 0.69314718055994530941723212145817656807550L
    310               + I * PIL * (0.5L - q);
    311             c = LOGPIL - c - clgaml(1.0L - x);
    312           }
    313         else
    314           {
    315             /* Reduce sine arg mod pi.  */
    316             u = csinl( PIL * (x - p) );
    317             if( u == 0.0L )
    318               goto loverf;
    319             w = clgaml(1.0L - x);
    320             c = LOGPIL - clogl( u ) - w;
    321             /* Adjust for reduced sine arg.  */
    322             //cimagl(c) += PIL * p;
    323             (long double)(__imag__ c = cimagl(c) + PIL * p);
    324           }
    325         goto ldone;
    326         }
    327 w = 0.0L;
    328 if( creall(x) < NLGITER )
    329         {
    330           /* To satisfy Im {clgam(z)} = arg cgamma(z), accumulate
    331              arg u during the recurrence.  */
    332           a = 0.0L;
    333           w = 1.0L;
    334           p = 0.0L;
    335           u = x;
    336           while( creall(u) < NLGITER )
    337                 {
    338                 if( u == 0.0L )
    339                         goto loverf;
    340                 w *= u;
    341                 a += cargl(u);
    342                 p += 1.0L;
    343                 u = x + p;
    344                 }
    345         x = u;
    346         /*      w = -logl(cabsl(w)) - I * a; */
    347         p = creall(w);
    348         q = cimagl(w);
    349         w = -0.5 * logl(p*p + q*q) - I * a;
    350         }
    351 
    352 if( creal(x) > MAXLGML )
    353         {
    354 loverf:
    355         mtherr( "clgaml", OVERFLOW );
    356         c = MAXNUML + MAXNUML * I;
    357         goto ldone;
    358         }
    359 
    360 c = ( x - 0.5L ) * clogl(x) - x + LS2PIL + w;
    361 
    362 if( cabsl(x) > 1.0e10L )
    363   goto ldone;
    364 
    365 v = 1.0L/(x*x);
    366 u = A[0];
    367 for (i = 1; i < NUMA; i++)
    368   {
    369     u = u * v + A[i];
    370   }
    371 c = c + u / x;
    372 
    373 ldone:
    374 if (cj)
    375   c = conj(c);
  • deleted file patches/c9x-complex/cgammal.patch

    -return( c );
    -}
    diff --git a/patches/c9x-complex/cgammal.patch b/patches/c9x-complex/cgammal.patch
    deleted file mode 100644
    + -  
    1 --- ../src/cgammal.c    2004-08-01 06:12:23.000000000 -0700
    2 +++ cgammal.c   2010-02-15 23:05:28.478417600 -0800
    3 @@ -317,7 +317,8 @@
    4             w = clgaml(1.0L - x);
    5             c = LOGPIL - clogl( u ) - w;
    6             /* Adjust for reduced sine arg.  */
    7 -           cimagl(c) += PIL * p;
    8 +           //cimagl(c) += PIL * p;
    9 +           (long double)(__imag__ c = cimagl(c) + PIL * p);
    10           }
    11         goto ldone;
    12         }
  • deleted file patches/c9x-complex/makefile

    diff --git a/patches/c9x-complex/makefile b/patches/c9x-complex/makefile
    deleted file mode 100644
    + -  
    1 # Makefile for C9X complex variables library
    2 # Edit endian-ness and computer type properly in mconf.h before compiling.
    3 # For additional test programs see also celefunt.mak.
    4 
    5 # Caution: the tests contain some references to the cephes math library
    6 # or references to standard float or long double functions that might
    7 # not be available.
    8 # This should be enough to run at least the double precision functions:
    9 LIBS = stubs.o -lm
    10 # These are intended to get the cephes libraries:
    11 #LIBS = -lml -lmd -lmf
    12 #LIBS = ../libml.a ../libmd.a ../libmf.a
    13 
    14 CC = gcc
    15 #CC = /b/gnu/gcc-build/gcc/xgcc -B/b/gnu/gcc-build/gcc/ -I/b/gnu/gcc-build/gcc
    16 # For 128-bit wide long double
    17 #PRECFLAGS = -DLD128BITS
    18 PRECFLAGS =
    19 CFLAGS = $(PRECFLAGS) -I. -g -O2 -Wall
    20 #CFLAGS = $(PRECFLAGS) -I. -g -O1 -Wall
    21 #CFLAGS = $(PRECFLAGS) -I. -g -O0 -Wall
    22 
    23 # float precision
    24 SFILES = cmplxf.o clogf.o cgammaf.o
    25 # double precision
    26 DFILES = cmplx.o clog.o cgamma.o
    27 # long double precision
    28 #LFILES =
    29 LFILES = cmplxl.o clogl.o cgammal.o
    30 LIBMCFILES = $(SFILES) $(DFILES) $(LFILES)
    31 
    32 # mtstf and mtstl test the float and long double functions.
    33 all: libmc.a mtst cvect dccalc mtstf whitebxf whitebx
    34 
    35 mtst: mtst.o $(DFILES) stubs.o
    36         $(CC) -v -o mtst mtst.o $(DFILES) $(LIBS)
    37 
    38 mtstf: mtstf.o $(SFILES) stubs.o
    39         $(CC) -o mtstf mtstf.o $(SFILES) $(LIBS)
    40 
    41 mtstl: mtstl.o $(LFILES) stubs.o
    42         $(CC) -o mtstl mtstl.o $(LFILES) $(LIBS)
    43 
    44 cvect: cvect.o clog.o cmplx.o stubs.o
    45         $(CC) -o cvect cvect.o clog.o cmplx.o $(LIBS)
    46 
    47 #cvect-nans: cvect-nans.o clog-nans.o cmplx-nans.o
    48 #       $(CC) -o cvect-nans cvect-nans.o clog-nans.o cmplx-nans.o $(LIBS)
    49 
    50 whitebxf: whitebxf.o libmc.a
    51         $(CC) $(CFLAGS) -o whitebxf whitebxf.o libmc.a $(LIBS)
    52 
    53 whitebxf.o: whitebxf.c complex.h
    54 
    55 whitebx: whitebx.o  libmc.a
    56         $(CC) $(CFLAGS) -o whitebx whitebx.o libmc.a $(LIBS)
    57 
    58 whitebx.o: whitebx.c complex.h
    59 
    60 
    61 libmc.a: $(LIBMCFILES)
    62         rm -f libmc.a
    63         ar rv libmc.a $(LIBMCFILES)
    64         ranlib libmc.a
    65 
    66 # Complex variable calculator program.
    67 # If you don't have the readline library, leave out the references to it
    68 # (and curses) or get the library from ftp.gnu.org.
    69 # If compiling on a 16-bit computer, you may need to set LARGEMEM 0
    70 # in dccalc.h.
    71 dccalc: dccalc.o
    72 #       $(CC) -o dccalc dccalc.o libmc.a -lreadline -lncurses $(LIBS)
    73         $(CC) -o dccalc dccalc.o libmc.a $(LIBS)
    74 
    75 dccalc.o: dccalc.c dccalc.h
    76 #       $(CC) $(CFLAGS) -DUSE_READLINE=1 -c dccalc.c
    77         $(CC) $(CFLAGS) -c dccalc.c
    78 
    79 clog.o: clog.c complex.h protos.h
    80 cmplx.o: cmplx.c complex.h protos.h
    81 clogf.o: clogf.c complex.h protos.h
    82 cmplxf.o: cmplxf.c complex.h protos.h
    83 clogl.o: clogl.c complex.h protos.h
    84 cmplxl.o: cmplxl.c complex.h protos.h
    85 #clog-nans.o: clog-nans.c complex.h protos.h
    86 #cmplx-nans.o: cmplx-nans.c complex.h protos.h
    87 
    88 check: mtst cvect mtstf whitebxf whitebx
    89         -./mtstf
    90         -./cvect
    91         -./mtst
    92         -./whitebxf
    93         -./whitebx
    94         echo For additional tests, make -f celefunt.mak
    95 
    96 clean:
    97         rm -f *.o
    98         rm -f mtst
    99         rm -f cvect
    100         rm -f mtstf
    101         rm -f mtstl
    102         rm -f cvect-nans
    103         rm -f dccalc
    104         rm -f libmc.a
    105         rm -f tcabs
    106         rm -f tcabsf
    107         rm -f tcexp
    108         rm -f tcexpf
    109         rm -f tclog
    110         rm -f tclogf
    111         rm -f tcpow
    112         rm -f tcpowf
    113         rm -f tcsin
    114         rm -f tcsinf
    115         rm -f tcsqrt
    116         rm -f tcsqrtf
    117         rm -f whitebxf
    118         rm -f whitebx
    119 
    120 #zip:
    121 #       rm -f c9x-complex.zip
    122 #       rm -f c9x-complex.shar
    123 #       rm -f c9x-complex.shar.gz
    124 #       zip c9x-complex.zip *.c *.h *.pat *.doc *.mak makefile read.me
    125 #       shar *.c *.h *.pat *.doc *.mak makefile read.me > c9x-complex.shar
    126 #       gzip c9x-complex.shar
  • deleted file patches/c9x-complex/makefile.patch

    diff --git a/patches/c9x-complex/makefile.patch b/patches/c9x-complex/makefile.patch
    deleted file mode 100644
    + -  
    1 --- ../src/makefile     2004-08-22 06:01:51.000000000 -0700
    2 +++ makefile    2010-02-15 23:51:13.535565200 -0800
    3 @@ -30,7 +30,7 @@
    4  LIBMCFILES = $(SFILES) $(DFILES) $(LFILES)
    5  
    6  # mtstf and mtstl test the float and long double functions.
    7 -all: libmc.a mtst cvect dccalc mtstf mtstl whitebxf whitebx
    8 +all: libmc.a mtst cvect dccalc mtstf whitebxf whitebx
    9  
    10  mtst: mtst.o $(DFILES) stubs.o
    11         $(CC) -v -o mtst mtst.o $(DFILES) $(LIBS)
    12 @@ -89,7 +89,6 @@
    13         -./mtstf
    14         -./cvect
    15         -./mtst
    16 -       -./mtstl
    17         -./whitebxf
    18         -./whitebx
    19         echo For additional tests, make -f celefunt.mak
  • deleted file patches/complex.h

    diff --git a/patches/complex.h b/patches/complex.h
    deleted file mode 100644
    + -  
    1 /* This is a C9X complex.h implementation for the GNU C compiler.
    2    It uses GNU extensions such as __complex__, but defines them
    3    so the syntax specified by C9X works.
    4 
    5    S. L. Moshier
    6    February, 1997  */
    7 
    8 
    9 /* This may look like something else, but it is really C9X.  */
    10 
    11 /* Use `I' as the imaginary unit.
    12    Initialize complex constants like this:
    13    double complex c = 1.0 + 2.0 * I;  */
    14 #define _Imaginary_I (1.0fi)
    15 #define _Complex_I (1.0fi)
    16 #define I _Imaginary_I
    17 
    18 /* These are not typed in gcc.  They preseve the type of the argument.  */
    19 /* Complex conjugate function.  */
    20 #define conj(x) (~(x))
    21 /* Function to get imaginary part.  */
    22 #define cimag(x) (__imag__ (x))
    23 /* Function to get real part.  */
    24 #define creal(x) (__real__ (x))
    25 
    26 extern double atan2 (double, double);
    27 #define carg(z) (atan2 ((double) cimag (z), (double) creal (z)))
    28 
    29 /* This is the new C language key word.
    30    ... Actually, the key word that the compiler is supposed to reserve
    31    and understand as part of the language is spelled "_Complex" but
    32    gcc understands "__complex__."  The macro "complex" is supposed to
    33    exist and expand to _Complex in complex.h.  But "_Complex" will seldom
    34    if ever appear in user programs.  */
    35 #define complex __complex__
    36 /* Remove this whenever gcc implements _Complex as a key word.  */
    37 #define _Complex __complex__
    38 
    39 /* These pragmas can't work without a compiler modification.  */
    40 #define CX_LIMITED_RANGE_ON
    41 #define CX_LIMITED_RANGE_OFF
    42 #define CX_LIMITED_RANGE_DEFAULT CX_LIMITED_RANGE_ON
    43 
    44 /* The builtin complex absolute value in gcc currently is unreachable
    45    due to overzealous type checking.  */
    46 extern double cabs ( double complex z );
    47 extern double hypot ( double x, double y );
    48 
    49 /* Prototypes for clog.c.
    50    This is how you declare complex things in the new C language.  */
    51 extern double complex clog ( double complex z );
    52 extern double complex cexp ( double complex z );
    53 extern double complex csqrt ( double complex z );
    54 extern double complex csin ( double complex z );
    55 extern double complex ccos ( double complex z );
    56 extern double complex ctan ( double complex z );
    57 extern double complex ccot ( double complex z );
    58 extern double complex casin ( double complex z );
    59 extern double complex cacos ( double complex z );
    60 extern double complex catan ( double complex z );
    61 extern double complex csinh ( double complex z );
    62 extern double complex casinh ( double complex z );
    63 extern double complex ccosh ( double complex z );
    64 extern double complex cacosh ( double complex z );
    65 extern double complex ctanh ( double complex z );
    66 extern double complex catanh ( double complex z );
    67 extern double complex cpow (double complex a, double complex z);
    68 
    69 /* These functions might be used if the compiler were to generate
    70    subroutine calls.  But their names would be spelled some other way.  */
    71 extern double complex cadd ( double complex a, double complex b );
    72 extern double complex csub ( double complex a, double complex b );
    73 extern double complex cmul ( double complex a, double complex b );
    74 extern double complex cdiv ( double complex a, double complex b );
    75 
    76 /* There are float and long double sizes, too.  */
    77 #define cimagf(x) ((float) __imag__ (x))
    78 #define crealf(x) ((float) __real__ (x))
    79 extern float atan2f (float, float);
    80 #define cargf(z) (atan2f ((float) cimag (z), (float) creal (z)))
    81 extern float cabsf ( float complex z );
    82 extern float complex clogf ( float complex z );
    83 extern float complex cexpf ( float complex z );
    84 extern float complex csqrtf ( float complex z );
    85 extern float complex csinf ( float complex z );
    86 extern float complex ccosf ( float complex z );
    87 extern float complex ctanf ( float complex z );
    88 extern float complex ccotf ( float complex z );
    89 extern float complex casinf ( float complex z );
    90 extern float complex cacosf ( float complex z );
    91 extern float complex catanf ( float complex z );
    92 extern float complex csinhf ( float complex z );
    93 extern float complex casinhf ( float complex z );
    94 extern float complex ccoshf ( float complex z );
    95 extern float complex cacoshf ( float complex z );
    96 extern float complex ctanhf ( float complex z );
    97 extern float complex catanhf ( float complex z );
    98 extern float complex cpowf (float complex a, float complex z);
    99 
    100 #define cimagl(x) ((long double) __imag__ (x))
    101 #define creall(x) ((long double) __real__ (x))
    102 extern long double atan2l (long double, long double);
    103 #define cargl(z) (atan2l ((long double) cimag (z), (long double) creal (z)))
    104 extern long double cabsl ( long double complex z );
    105 extern long double complex clogl ( long double complex z );
    106 extern long double complex cexpl ( long double complex z );
    107 extern long double complex csqrtl ( long double complex z );
    108 extern long double complex csinl ( long double complex z );
    109 extern long double complex ccosl ( long double complex z );
    110 extern long double complex ctanl ( long double complex z );
    111 extern long double complex ccotl ( long double complex z );
    112 extern long double complex casinl ( long double complex z );
    113 extern long double complex cacosl ( long double complex z );
    114 extern long double complex catanl ( long double complex z );
    115 extern long double complex csinhl ( long double complex z );
    116 extern long double complex casinhl ( long double complex z );
    117 extern long double complex ccoshl ( long double complex z );
    118 extern long double complex cacoshl ( long double complex z );
    119 extern long double complex ctanhl ( long double complex z );
    120 extern long double complex catanhl ( long double complex z );
    121 extern long double complex cpowl (long double complex a, long double complex z);
    122 extern float complex clgamf ( float complex z );
    123 extern double complex clgam ( double complex z );
    124 extern long double complex clgaml ( long double complex z );
    125 extern float complex cgammaf ( float complex z );
    126 extern double complex cgamma ( double complex z );
    127 extern long double complex cgammal ( long double complex z );
  • deleted file patches/complex.h.patch

    diff --git a/patches/complex.h.patch b/patches/complex.h.patch
    deleted file mode 100644
    + -  
    1 --- ../src/complex.h    2000-02-05 17:39:53.000000000 -0800
    2 +++ complex.h   2010-04-27 10:06:23.866193925 -0700
    3 @@ -12,6 +12,7 @@
    4     Initialize complex constants like this:
    5     double complex c = 1.0 + 2.0 * I;  */
    6  #define _Imaginary_I (1.0fi)
    7 +#define _Complex_I (1.0fi)
    8  #define I _Imaginary_I
    9  
    10  /* These are not typed in gcc.  They preseve the type of the argument.  */
  • deleted file patches/double/makefile

    diff --git a/patches/double/makefile b/patches/double/makefile
    deleted file mode 100644
    + -  
    1 # Double precision Cephes library
    2 # Makefile for unix or GCC
    3 
    4 CC = gcc
    5 #CC = /a/gnu/linux/gcc/xgcc -B/a/gnu/linux/gcc/ -I/a/gnu/linux/gcc/include
    6 #CFLAGS = -g -O2 -Wall -fno-builtin # -ffloat-store
    7 CFLAGS = -g -O2 -Wall -fno-builtin
    8 AR = ar
    9 RANLIB = ranlib
    10 INCS = mconf.h
    11 AS = as
    12 
    13 OBJS = acosh.o airy.o asin.o asinh.o atan.o atanh.o bdtr.o beta.o \
    14 btdtr.o cbrt.o chbevl.o chdtr.o clog.o cmplx.o const.o \
    15 cosh.o dawsn.o drand.o ei.o ellie.o ellik.o ellpe.o ellpj.o ellpk.o \
    16 exp.o exp10.o exp2.o expn.o fabs.o fac.o fdtr.o \
    17 fresnl.o gamma.o gdtr.o hyp2f1.o hyperg.o i0.o i1.o igami.o incbet.o \
    18 incbi.o igam.o isnan.o iv.o j0.o j1.o jn.o jv.o k0.o k1.o kn.o kolmogorov.o \
    19 log.o log2.o log10.o lrand.o nbdtr.o ndtr.o ndtri.o pdtr.o planck.o \
    20 polevl.o polmisc.o polylog.o polyn.o pow.o powi.o psi.o rgamma.o round.o \
    21 shichi.o sici.o sin.o sindg.o sinh.o spence.o stdtr.o struve.o \
    22 tan.o tandg.o tanh.o unity.o yn.o zeta.o zetac.o \
    23 sqrt.o floor.o setprec.o mtherr.o
    24 
    25 all: libmd.a mtst dtestvec monot dcalc # stamp-timing
    26 
    27 stamp-timing: libmd.a mtst time-it
    28         time-it "mtst > /dev/null"
    29         touch stamp-timing
    30 
    31 time-it: time-it.o
    32         $(CC) -o time-it time-it.o
    33 
    34 time-it.o: time-it.c
    35         $(CC) -O2 -c time-it.c
    36 
    37 dcalc: dcalc.o libmd.a
    38         $(CC) -o dcalc dcalc.o libmd.a
    39 #       aout2exe mtst
    40 
    41 mtst: mtst.o libmd.a
    42         $(CC) -v -o mtst mtst.o libmd.a
    43 #       gcc -Wl,-verbose -b i486-linuxaout -v -o mtst mtst.o libmd.a
    44 #       coff2exe mtst
    45 
    46 mtst.o: mtst.c
    47         $(CC) -O2 -Wall -c mtst.c
    48 
    49 dtestvec: dtestvec.o libmd.a
    50         $(CC) -o dtestvec dtestvec.o libmd.a
    51 
    52 dtestvec.o: dtestvec.c
    53         $(CC) -g -c dtestvec.c
    54 
    55 monot: monot.o libmd.a
    56         $(CC) -o monot monot.o libmd.a
    57 
    58 monot.o: monot.c
    59         $(CC) -g -c monot.c
    60 
    61 paranoia: paranoia.o setprec.o libmd.a
    62         $(CC) -o paranoia paranoia.o setprec.o libmd.a
    63 
    64 paranoia.o: paranoia.c
    65         $(CC) $(CFLAGS) -Wno-implicit -c paranoia.c
    66 
    67 libmd.a: $(OBJS) $(INCS)
    68 # for real Unix:
    69         $(AR) rv libmd.a $(OBJS)
    70 # for djgcc MSDOS:
    71 #       >libmd.rf -rv libmd.a $(OBJS)
    72 #       $(AR) @libmd.rf
    73         $(RANLIB) libmd.a
    74 
    75 # If the following are all commented out, the C versions
    76 # will be used by default.
    77 
    78 # IBM PC:
    79 #sqrt.o: sqrt.387
    80 #       $(AS) -o sqrt.o sqrt.387
    81 #
    82 #floor.o: floor.387
    83 #       $(AS) -o floor.o floor.387
    84 #
    85 #setprec.o: setprec.387
    86 #       $(AS) -o setprec.o setprec.387
    87 
    88 # ELF versions for linux (no underscores)
    89 #sqrt.o: sqrtelf.387
    90 #       $(AS) -o sqrt.o sqrtelf.387
    91 
    92 #floor.o: floorelf.387
    93 #       $(AS) -o floor.o floorelf.387
    94 
    95 #setprec.o: setprelf.387
    96 #       $(AS) -o setprec.o setprelf.387
    97 
    98 # Motorola 68881. Caution, subroutine return conventions vary.
    99 #sqrt.o: sqrt.688
    100 #       $(AS) -o sqrt.o sqrt.688
    101 #
    102 #setprec.o: setprec.688
    103 #       $(AS) -o setprec.o setprec.688
    104 
    105 # SPARC:
    106 #sqrt.o: sqrt.spa
    107 #       $(AS) -o sqrt.o sqrt.spa
    108 
    109 clean:
    110         rm -f *.o
    111         rm -f mtst
    112         rm -f paranoia
    113         rm -f dcalc
    114         rm -f dtestvec
    115         rm -f monot
    116         rm -f libmd.a
    117         rm -f time-it
    118         rm -f dtestvec
    119 
  • deleted file patches/ldouble/makefile

    diff --git a/patches/ldouble/makefile b/patches/ldouble/makefile
    deleted file mode 100644
    + -  
    1 # Unix make file for long double precision function library
    2 # Be sure to check the size of a pointer, LARGEMEM, in lcalc.h;
    3 # the size of long double, XPD, in mconf.h; and the type of
    4 # computer and endianness of the numbers in mconf.h.
    5 CC= gcc
    6 #CC = /a/gnu/linux/gcc/xgcc -B/a/gnu/linux/gcc/ -I/a/gnu/linux/gcc/include
    7 #CFLAGS= -O0 -fno-builtin
    8 CFLAGS= -O2 -Wall -Wuninitialized -fno-builtin
    9 LIBS=
    10 OBJS= acoshl.o asinhl.o asinl.o atanhl.o atanl.o bdtrl.o btdtrl.o cbrtl.o \
    11 chdtrl.o coshl.o ellpel.o ellpkl.o elliel.o ellikl.o ellpjl.o \
    12 exp10l.o exp2l.o expl.o fdtrl.o gammal.o gdtrl.o igamil.o igaml.o \
    13 incbetl.o incbil.o isnanl.o j0l.o j1l.o jnl.o ldrand.o log10l.o log2l.o \
    14 logl.o nbdtrl.o ndtril.o ndtrl.o pdtrl.o powl.o powil.o sinhl.o sinl.o \
    15 sqrtl.o stdtrl.o tanhl.o tanl.o unityl.o ynl.o \
    16 floorl.o polevll.o unityl.o mtherr.o
    17 # cmplxl.o clogl.o
    18 
    19 all: mtstl lcalc fltestl nantst testvect monotl libml.a
    20 
    21 mtstl: libml.a mtstl.o $(OBJS)
    22         $(CC) $(CFLAGS) -o mtstl mtstl.o libml.a $(LIBS)
    23 #       aout2exe mtstl
    24 
    25 mtstl.o: mtstl.c
    26 
    27 lparanoi: libml.a lparanoi.o setprec.o ieee.o econst.o $(OBJS)
    28         $(CC) $(CFLAGS) -o lparanoi lparanoi.o setprec.o ieee.o econst.o libml.a $(LIBS)
    29 #       aout2exe lparanoi
    30 
    31 lparanoi.o: lparanoi.c
    32         $(CC) $(CFLAGS) -Wno-implicit -c lparanoi.c
    33 
    34 econst.o: econst.c ehead.h
    35 
    36 lcalc: libml.a lcalc.o ieee.o econst.o $(OBJS)
    37         $(CC) $(CFLAGS) -o lcalc lcalc.o ieee.o econst.o libml.a $(LIBS)
    38 
    39 lcalc.o: lcalc.c lcalc.h ehead.h
    40 
    41 ieee.o: ieee.c ehead.h
    42 
    43 # Use $(OBJS) in ar command for libml.a if possible; else *.o
    44 libml.a: $(OBJS) mconf.h
    45         ar -rv libml.a $(OBJS)
    46         ranlib libml.a
    47 #       ar -rv libml.a *.o
    48 
    49 # Use assembly language sqrt and floor if available.
    50 # sqrtl.c does not give strictly rounded results.
    51 # The floor.c routines are slow.
    52 #floorl.o: floorl.387
    53 #       as -o floorl.o floorl.387
    54 #sqrtl.o: sqrtl.387
    55 #       as -o sqrtl.o sqrtl.387
    56 #setprec.o: setprec.387
    57 #       as -o setprec.o setprec.387
    58 
    59 # ELF versions for linux
    60 #floorl.o: floorlelf.387
    61 #       as -o floorl.o floorlelf.387
    62 #sqrtl.o: sqrtlelf.387
    63 #       as -o sqrtl.o sqrtlelf.387
    64 #setprec.o: setprelf.387
    65 #       as -o setprec.o setprelf.387
    66 
    67 # 68K routines
    68 # For Sun 3
    69 #floorl.o: floorl.sun
    70 #       as -o floorl.o floorl.sun
    71 #setprec.o: setprec.688
    72 #       as -o setprec.o setprec.688
    73 #sqrtl.o: sqrtl.sun
    74 #       as -o sqrtl.o sqrtl.sun
    75 
    76 # For Motorola 68k sysv
    77 # Thanks to Philippe De Muyter <phdm@info.ucl.ac.be>
    78 #floorl.o: floorl.mot
    79 #       as -o floorl.o floorl.mot
    80 #setprec.o: setprec.mot
    81 #       as -o setprec.o setprec.mot
    82 #sqrtl.o: sqrtl.mot
    83 #       as -o sqrtl.o sqrtl.mot
    84 
    85 fltestl: fltestl.c libml.a
    86         $(CC) $(CFLAGS) -o fltestl fltestl.c libml.a
    87 
    88 fltestl.o: fltestl.c
    89 
    90 flrtstl: flrtstl.c libml.a
    91         $(CC) $(CFLAGS) -o flrtstl flrtstl.c libml.a
    92 
    93 flrtstl.o: flrtstl.c
    94 
    95 nantst: nantst.c libml.a
    96         $(CC) $(CFLAGS) -o nantst nantst.c libml.a
    97 
    98 nantst.o: nantst.c
    99 
    100 testvect: testvect.o libml.a
    101         $(CC) $(CFLAGS) -o testvect testvect.o libml.a
    102 
    103 testvect.o: testvect.c
    104         $(CC) -g -c -o testvect.o testvect.c
    105 
    106 monotl: monotl.o libml.a
    107         $(CC) $(CFLAGS) -o monotl monotl.o libml.a
    108 
    109 monotl.o: monotl.c
    110         $(CC) -g -c -o monotl.o monotl.c
    111 
    112 acoshl.o: acoshl.c
    113 asinhl.o: asinhl.c
    114 asinl.o: asinl.c
    115 atanhl.o: atanhl.c
    116 atanl.o: atanl.c
    117 bdtrl.o: bdtrl.c
    118 btdtrl.o: btdtrl.c
    119 cbrtl.o: cbrtl.c
    120 chdtrl.o: chdtrl.c
    121 coshl.o: coshl.c
    122 ellpel.o: ellpel.c
    123 ellpkl.o: ellpkl.c
    124 elliel.o: elliel.c
    125 ellikl.o: ellikl.c
    126 ellpjl.o: ellpjl.c
    127 exp10l.o: exp10l.c
    128 exp2l.o: exp2l.c
    129 expl.o: expl.c
    130 fdtrl.o: fdtrl.c
    131 gammal.o: gammal.c
    132 gdtrl.o: gdtrl.c
    133 igamil.o: igamil.c
    134 igaml.o: igaml.c
    135 incbetl.o: incbetl.c
    136 incbil.o: incbil.c
    137 isnanl.o: isnanl.c
    138 j0l.o: j0l.c
    139 j1l.o: j1l.c
    140 jnl.o: jnl.c
    141 ldrand.o: ldrand.c
    142 log10l.o: log10l.c
    143 log2l.o: log2l.c
    144 logl.o: logl.c
    145 nbdtrl.o: nbdtrl.c
    146 ndtril.o: ndtril.c
    147 ndtrl.o: ndtrl.c
    148 pdtrl.o: pdtrl.c
    149 powl.o: powl.c
    150 powil.o: powil.c
    151 sinhl.o: sinhl.c
    152 sinl.o: sinl.c
    153 sqrtl.o: sqrtl.c
    154 stdtrl.o: stdtrl.c
    155 tanhl.o: tanhl.c
    156 tanl.o: tanl.c
    157 unityl.o: unityl.c
    158 ynl.o: ynl.c
    159 floorl.o: floorl.c
    160 polevll.o: polevll.c
    161 unityl.o: unityl.c
    162 mtherr.o: mtherr.c
    163 
    164 clean:
    165         rm -f *.o
    166         rm -f mtstl
    167         rm -f lcalc
    168         rm -f fltestl
    169         rm -f flrtstl
    170         rm -f nantst
    171         rm -f lparanoi
    172         rm -f testvect
    173         rm -f libml.a
    174 
    175 # Run test programs
    176 check: mtstl fltestl testvect monotl libml.a
    177         -mtstl
    178         -fltestl
    179         -testvect
    180         -monotl
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    11#!/usr/bin/env bash
    22
    3 if [ "$UNAME" != "CYGWIN" ]; then
    4     echo "We do not install the cephes library on any operating system except Cygwin."
     3if [[ -z "$SAGE_LOCAL" ]]; then
     4    echo >&2 "Error: SAGE_LOCAL undefined - exiting..."
     5    echo >&2 "Maybe run 'sage -sh'?"
     6    exit 1
     7fi
     8
     9if [ "$UNAME" != "FreeBSD" ]; then
     10    echo "We only install the cephes library on FreeBSD."
    511    exit 0
    612fi
    713
    814CUR=`pwd`
     15cd src
    916
    10 function patch {
    11     cd "$CUR"
    12     cp patches/complex.h src/
    13 }
     17# Apply patches:
     18echo "Applying patches (if any)..."
     19for patch in ../patches/*.patch; do
     20    patch -p1 <"$patch"
     21    if [ $? -ne 0 ]; then
     22        echo >&2 "Patch '$patch' failed to apply."
     23        exit 1
     24    fi
     25done
    1426
    15 function make_complex_h {
    16     cd "$CUR"
    17     cp src/complex.h "$SAGE_LOCAL"/include
    18 }
     27echo "Building Cephes..."
     28$MAKE
     29if [ $? -ne 0 ]; then
     30   echo >&2 "Error - Failed to build Cephes ... exiting"
     31   exit 1
     32fi
    1933
    20 function make_single {
    21     cd "$CUR"
    22     cd src/single
    23     make
    24    
    25     cp libmf.a "$SAGE_LOCAL"/lib/
    26     cp protos.h "$SAGE_LOCAL"/include/cephes_single.h
    27 
    28     cd "$CUR"
    29 }
    30 
    31 function make_double {
    32     cd "$CUR"
    33     cp patches/double/makefile  src/double
    34 
    35     cd src/double
    36 
    37     make
    38 
    39     cp libmd.a "$SAGE_LOCAL"/lib/
    40    
    41     cd "$CUR"
    42 }
    43 
    44 function make_ldouble {
    45     cd "$CUR"
    46     cp patches/ldouble/makefile  src/ldouble
    47 
    48     cd src/ldouble
    49     make
    50    
    51     cp libml.a "$SAGE_LOCAL"/lib/
    52     cp protos.h "$SAGE_LOCAL"/include/cephes_ldouble.h
    53 
    54     cd "$CUR"
    55 }
    56 
    57 function make_c9x_complex {
    58     cd "$CUR"
    59    
    60     cp patches/c9x-complex/*.c src/c9x-complex/
    61     cp patches/c9x-complex/makefile src/c9x-complex/
    62 
    63     cd src/c9x-complex/
    64 
    65     make
    66    
    67     cp libmc.a "$SAGE_LOCAL"/lib/
    68  
    69     cd "$CUR"
    70 }
    71 
    72 function build {
    73     make_complex_h
    74     make_single
    75     make_double
    76     make_ldouble
    77     make_c9x_complex
    78 }
    79 
    80 patch
    81 build
     34echo "Installing Cephes..."
     35$MAKE install
     36if [ $? -ne 0 ]; then
     37   echo >&2 "Error - Failed to build Cephes ... exiting"
     38   exit 1
     39fi