/*
 * 
 * $Copyright
 * Copyright 1993, 1994, 1995  Intel Corporation
 * INTEL CONFIDENTIAL
 * The technical data and computer software contained herein are subject
 * to the copyright notices; trademarks; and use and disclosure
 * restrictions identified in the file located in /etc/copyright on
 * this system.
 * Copyright$
 * 
 */
 
/*
 * (c) Copyright 1990, OPEN SOFTWARE FOUNDATION, INC.
 * ALL RIGHTS RESERVED
 */
/*
 * OSF/1 Release 1.0
 */
/* @(#)math.h   1.25  com/inc,3.1,9013 3/13/90 11:37:37 */
/*
 * COMPONENT_NAME: (math.h) math header file
 *
 * ORIGINS: 27
 *
 * (C) COPYRIGHT International Business Machines Corp. 1985, 1988, 1989
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 *
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 */

#ifndef  _MATH_H_
#define  _MATH_H_
#include <standards.h>

/*
 *      The ANSI standard requires that certain values be in math.h.
 *      It also requires that if _ANSI_C_SOURCE is defined then ONLY these
 *      values are present.
 *
 *      This header includes all the ANSI required entries. In addition
 *      other entries for the XIX system are included.
 *
 */

/*
 *      ANSI required entries in math.h
 *
 */
#ifdef _ANSI_C_SOURCE

#ifdef _NO_PROTO

  double acos();
  double asin();
  double atan();
  double atan2();
  double ceil();
  double cos();
  double cosh();
  double exp();
  double fabs();
  double floor();
  double fmod();
  double frexp();
  double ldexp();
  double log();
  double log10();
  double modf();
  double pow();
  double remainder();
  double sin();
  double sinh();
  double sqrt();
  double tan();
  double tanh();

#else  /*_NO_PROTO */			/* Use ANSI C required prototyping */

  double acos(double );
  double asin(double );
  double atan(double );
  double atan2(double ,double );
  double ceil(double );
  double cos(double );
  double cosh(double );
  double exp(double );
  double fabs(double );
  double floor(double );
  double fmod(double , double );
  double frexp(double , int *);
  double ldexp(double , int );
  double log(double );
  double log10(double );
  double modf(double , double *);
  double pow(double , double );
  double remainder(double , double);
  double sin(double );
  double sinh(double );
  double sqrt(double );
  double tan(double );
  double tanh(double );

#endif /*_NO_PROTO */
#endif /*_ANSI_C_SOURCE */

/*
 *
 * The following function prototypes define functions available in the
 * XIX system but not required by the ANSI standard. They will not be
 * included in _ANSI_C_SOURCE is defined (strict ANSI conformance).
 *
 */

#ifdef _XOPEN_SOURCE

extern int signgam;


#ifdef _NO_PROTO
     double   erf();
     double   erfc();
     double   gamma();
     double   hypot();
     int      isnan();
     double   j0();
     double   j1();
     double   jn();
     double   lgamma();
     double   y0();
     double   y1();
     double   yn();

#else
     double   erf(double );
     double   erfc(double );
     double   gamma(double );
     double   hypot(double ,double );
     int      isnan(double );
     double   j0(double );
     double   j1(double );
     double   jn(int n, double );
     double   lgamma(double );
     double   y0(double );
     double   y1(double );
     double   yn(int , double );

#endif /* _NO_PROTO */

#endif /* _XOPEN_SOURCE */

#ifdef _OSF_SOURCE

#include <stdlib.h>

#ifdef _NO_PROTO

     double   acosh();
     double   asinh();
     double   atanh();
     double   cabs();
     double   cbrt();
     double   copysign ();
     double   drem();
     double   expm1();
     double   log1p();
     double   logb();
     double   rint();
     double   scalb();
     int      finite();

#else /* _NO_PROTO */			/* Use ANSI C required prototyping */

     typedef struct { double r, i; } osfcomplex;
     double   acosh(double );
     double   asinh(double );
     double   atanh(double );
     double   cabs(osfcomplex);
     double   cbrt(double );
     double   copysign (double , double );
     double   drem(double , double );
     double   expm1(double );
     double   log1p(double );
     double   logb(double);
     double   rint(double );
     double   scalb(double , int );
     int      finite();


#endif /* _NO_PROTO */

#define _ABS(x) ((x) < 0 ? -(x) : (x))
#define _REDUCE(TYPE, X, XN, C1, C2)    { \
        double x1 = (double)(TYPE)X, x2 = X - x1; \
        X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); }
#define _POLY1(x, c)    ((c)[0] * (x) + (c)[1])
#define _POLY2(x, c)    (_POLY1((x), (c)) * (x) + (c)[2])
#define _POLY3(x, c)    (_POLY2((x), (c)) * (x) + (c)[3])
#define _POLY4(x, c)    (_POLY3((x), (c)) * (x) + (c)[4])
#define _POLY5(x, c)    (_POLY4((x), (c)) * (x) + (c)[5])
#define _POLY6(x, c)    (_POLY5((x), (c)) * (x) + (c)[6])
#define _POLY7(x, c)    (_POLY6((x), (c)) * (x) + (c)[7])
#define _POLY8(x, c)    (_POLY7((x), (c)) * (x) + (c)[8])
#define _POLY9(x, c)    (_POLY8((x), (c)) * (x) + (c)[9])


struct exception {
	int type;
	char *name;
	double arg1;
	double arg2;
	double retval;
};

#define 	DOMAIN		01
#define		SING		02
#define		OVERFLOW	03
#define		UNDERFLOW	04
#define		TLOSS		05
#define		PLOSS		06

#endif /* _OSF_SOURCE */

/* N.B.  This FILE must be catenated with a machine-dependent file  ${MACHINE}/math.h
   with ends with #endif for _MATH_H_ feature-test
*/

