delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/08/27/15:51:51

From: Kbwms AT aol DOT com
Message-ID: <1cd.fda5102.2c7e5b12@aol.com>
Date: Wed, 27 Aug 2003 15:05:54 EDT
Subject: Re: <math.h> and <libm/math.h>
To: djgpp-workers AT delorie DOT com
MIME-Version: 1.0
X-Mailer: 8.0 for Windows sub 6015
Reply-To: djgpp-workers AT delorie DOT com

--part1_1cd.fda5102.2c7e5b12_boundary
Content-Type: multipart/alternative;
	boundary="part1_1cd.fda5102.2c7e5b12_alt_boundary"


--part1_1cd.fda5102.2c7e5b12_alt_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

In a message dated 8/27/2003 2:52:12 PM Eastern Standard Time, 
ams AT ludd DOT luth DOT se writes:

> >I think we should simply modify include/libm.h so that it works both
> >for libc.a and for libm.a (when compiling the libraries _and_ when
> >compiling programs that use the libraries).  Then we could have
> ><libm/math.h> include <math.h> (for back-compatibility) and do nothing
> >else.
> 

Attached is a version of math.h that I use regularly with my long double 
stuff. It contains #ifdefs that avoid conflicts with ieeefp.h.  Perhaps that would 
be of some help.


KB Williams

--part1_1cd.fda5102.2c7e5b12_alt_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<HTML><FONT FACE=3Darial,helvetica><FONT  SIZE=3D3 FAMILY=3D"SERIF" FACE=3D"=
Georgia" LANG=3D"0">In a message dated 8/27/2003 2:52:12 PM Eastern Standard=
 Time, ams AT ludd DOT luth DOT se writes:<BR>
<BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px"></FONT><FONT  COLOR=3D"#000000"=
 style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"A=
rial" LANG=3D"0">&gt;I think we should simply modify include/libm.h so that=20=
it works both<BR>
&gt;for libc.a and for libm.a (when compiling the libraries _and_ when<BR>
&gt;compiling programs that use the libraries).&nbsp; Then we could have<BR>
&gt;&lt;libm/math.h&gt; include &lt;math.h&gt; (for back-compatibility) and=20=
do nothing<BR>
&gt;else.<BR>
</BLOCKQUOTE><BR>
</FONT><FONT  COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3=
 FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0"><BR>
Attached is a version of math.h that I use regularly with my long double stu=
ff. It contains #ifdefs that avoid conflicts with ieeefp.h.&nbsp; Perhaps th=
at would be of some help.<BR>
<BR>
<BR>
KB Williams</FONT></HTML>

--part1_1cd.fda5102.2c7e5b12_alt_boundary--

--part1_1cd.fda5102.2c7e5b12_boundary
Content-Type: text/plain; name="math.h"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="math.h"

/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_math_h_
#define __dj_include_math_h_

#ifdef _USE_LIBM_MATH_H
#include <libm/math.h>
#else

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __dj_ENFORCE_ANSI_FREESTANDING

extern double __dj_huge_val;
#define HUGE_VAL  __dj_huge_val

double=09acos(double _x);
double=09asin(double _x);
double=09atan(double _x);
double=09atan2(double _y, double _x);
double=09ceil(double _x);
double=09cos(double _x);
double=09cosh(double _x);
double=09exp(double _x);
double=09fabs(double _x);
double=09floor(double _x);
double=09fmod(double _x, double _y);
double=09frexp(double _x, int *_pexp);
double=09ldexp(double _x, int _exp);
double=09log(double _y);
double=09log10(double _x);
double=09modf(double _x, double *_pint);
double=09pow(double _x, double _y);
double=09sin(double _x);
double=09sinh(double _x);
double=09sqrt(double _x);
double=09tan(double _x);
double=09tanh(double _x);

#ifndef __STRICT_ANSI__

#ifndef _POSIX_SOURCE

#define M_E=09=092.7182818284590452354
#define M_LOG2E=09=091.4426950408889634074
#define M_LOG10E=090.43429448190325182765
#define M_LN2=09=090.69314718055994530942
#define M_LN10=09=092.30258509299404568402
#define M_PI=09=093.14159265358979323846
#define M_PI_2=09=091.57079632679489661923
#define M_PI_4=09=090.78539816339744830962
#define M_1_PI=09=090.31830988618379067154
#define M_2_PI=09=090.63661977236758134308
#define M_2_SQRTPI=091.12837916709551257390
#define M_SQRT2=09=091.41421356237309504880
#define M_SQRT1_2=090.70710678118654752440
#define PI=09=09M_PI
#define PI2=09=09M_PI_2

double=09acosh(double);
double=09asinh(double);
double=09atanh(double);
double=09cbrt(double);
double=09exp10(double _x);
double=09exp2(double _x);
double=09expm1(double);
double=09hypot(double, double);
double=09log1p(double);
double=09log2(double _x);
long double modfl(long double _x, long double *_pint);
double=09pow10(double _x);
double=09pow2(double _x);
double=09powi(double, int);
void=09sincos(double *, double *, double);

/* These are in libm.a (Cygnus).  You must link -lm to get these */
/* See libm/math.h for comments */

#ifndef __cplusplus
struct exception {
=09int type;
=09const char *name;
=09double arg1;
=09double arg2;
=09double retval;
=09int err;
};
#endif

extern double erf(double);
extern double erfc(double);
extern double gamma(double);
extern int isinf(double);
extern int isnan(double);
extern int finite(double);
extern double j0(double);
extern double j1(double);
extern double jn(int, double);
extern double lgamma(double);
extern double nan(void);
extern double y0(double);
extern double y1(double);
extern double yn(int, double);
extern double logb(double);
extern double nextafter(double, double);
extern double remainder(double, double);
extern double scalb(double, double);
#ifndef __cplusplus
extern int matherr(struct exception *);
#endif
extern double significand(double);
extern double copysign(double, double);
extern int ilogb(double);
extern double rint(double);
extern double scalbn(double, int);
extern double drem(double, double);
extern double gamma_r(double, int *);
extern double lgamma_r(double, int *);
extern float acosf(float);
extern float asinf(float);
extern float atanf(float);
extern float atan2f(float, float);
extern float cosf(float);
extern float sinf(float);
extern float tanf(float);
extern float coshf(float);
extern float sinhf(float);
extern float tanhf(float);
extern float expf(float);
extern float frexpf(float, int *);
extern float ldexpf(float, int);
extern float logf(float);
extern float log10f(float);
extern float modff(float, float *);
extern float powf(float, float);
extern float sqrtf(float);
extern float ceilf(float);
extern float fabsf(float);
extern float floorf(float);
extern float fmodf(float, float);
extern float erff(float);
extern float erfcf(float);
extern float gammaf(float);
extern float hypotf(float, float);
# if !defined isinff
extern int isinff(float);
# endif
# if !defined isnanf
extern int isnanf(float);
# endif
# if !defined finitef
extern int finitef(float);
# endif
extern float j0f(float);
extern float j1f(float);
extern float jnf(int, float);
extern float lgammaf(float);
extern float nanf(void);
extern float y0f(float);
extern float y1f(float);
extern float ynf(int, float);
extern float acoshf(float);
extern float asinhf(float);
extern float atanhf(float);
extern float cbrtf(float);
extern float logbf(float);
extern float nextafterf(float, float);
extern float remainderf(float, float);
extern float scalbf(float, float);
extern float significandf(float);
extern float copysignf(float, float);
extern int ilogbf(float);
extern float rintf(float);
extern float scalbnf(float, int);
extern float dremf(float, float);
extern float expm1f(float);
extern float log1pf(float);
extern float gammaf_r(float, int *);
extern float lgammaf_r(float, int *);

#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */

#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */

#ifdef __cplusplus
}
#endif

#endif /* _USE_LIBM_MATH_H */

#ifdef __cplusplus
extern "C" {
#endif

/* ------------------- */
/* FUNCTION PROTOTYPES */
/* ------------------- */
# if !defined __F
# if defined(__STDC__)
#=09define=09__F( P )  P
# else
#=09define=09__F( P )  ()
# endif
# endif

/* *INDENT-OFF* */

extern=09long=09double acoshl=09  __F((long double));
extern=09long=09double acosl=09  __F((long double));
extern=09long=09double asinhl=09  __F((long double));
extern=09long=09double asinl=09  __F((long double));
extern=09long=09double atan2l=09  __F((long double, long double));
extern=09long=09double atanhl=09  __F((long double));
extern=09long=09double atanl=09  __F((long double));
extern=09long=09double cbrtl=09  __F((long double));
extern=09long=09double ceill=09  __F((long double));
extern=09long=09double copysignl  __F((long double, long double));
extern=09long=09double coshl=09  __F((long double));
extern=09long=09double cosl=09  __F((long double));
extern=09long=09double cotl=09  __F((long double));
extern=09long=09double erfcl=09  __F((long double));
extern=09long=09double erfl=09  __F((long double));
extern=09long=09double exp2l=09  __F((long double));
extern=09long=09double expl=09  __F((long double));
extern=09long=09double expm1l=09  __F((long double));
extern=09long=09double fabsl=09  __F((long double));
extern=09long=09double fdiml=09  __F((long double, long double));
extern=09long=09double floorl=09  __F((long double));
extern=09long=09double fmaxl=09  __F((long double, long double));
extern=09long=09double fminl=09  __F((long double, long double));
extern=09long=09double fmodl=09  __F((long double, long double));
extern=09int=09fpclassifyl=09  __F((long double));
extern=09long=09double frexpl=09  __F((long double, int *));
extern=09long=09double hypotl=09  __F((long double, long double));
extern=09int=09ilogbl=09=09  __F((long double));
extern=09long=09double _infinityl __F((void));
extern=09int=09isfinitel=09  __F((long double));
extern=09int=09isinfl=09=09  __F((long double));
extern=09int=09isnanl=09=09  __F((long double));
extern=09long=09double j0l=09  __F((long double));
extern=09long=09double j1l=09  __F((long double));
extern=09long=09double jnl=09  __F((int, long double));
extern=09long=09double ldexpl=09  __F((long double, int));
extern=09long=09double lgammal=09  __F((long double));
extern=09long=09double lgammal_r  __F((long double, int *));
extern=09long=09long int llrintl  __F((long double));
extern=09long=09long int llroundl __F((long double));
extern=09long=09int lrintl=09  __F((long double));
extern=09long=09int lroundl=09  __F((long double));
extern=09long=09double log10l=09  __F((long double));
extern=09long=09double log1pl=09  __F((long double));
extern=09long=09double log2l=09  __F((long double));
extern=09long=09double logbl=09  __F((long double));
extern=09long=09double logl=09  __F((long double));
extern=09long=09double modfl=09  __F((long double, long double *));
extern=09long=09double nanl=09  __F((const char *));
extern=09long=09double _nanl=09  __F((void));
extern=09long=09double nearbyintl __F((long double));
extern=09long=09double nextafterl __F((long double, long double));
extern=09long=09double powil=09  __F((long double, int));
extern=09long=09double powl=09  __F((long double, long double));
extern=09long=09double remainderl __F((long double, long double));
extern=09long=09double remquol=09  __F((long double, long double, int *));
extern=09long=09double rintl=09  __F((long double));
extern=09long=09double roundl=09  __F((long double));
extern=09long=09double scalblnl=09  __F((long double, long int));
extern=09long=09double scalbnl=09  __F((long double, int));
extern=09int=09signbitl=09  __F((long double));
extern=09long=09double sinhl=09  __F((long double));
extern=09long=09double sinl=09  __F((long double));
extern=09long=09double sqrtl=09  __F((long double));
extern=09long=09double tanl=09  __F((long double));
extern=09long=09double tanhl=09  __F((long double));
extern=09long=09double tgammal=09  __F((long double));
extern=09long=09double truncl=09  __F((long double));
extern=09long=09double y0l=09  __F((long double));
extern=09long=09double y1l  =09  __F((long double));
extern=09long=09double ynl=09  __F((int, long double));

/* *INDENT-ON* */


#ifdef __cplusplus
}
#endif

#endif /* !__dj_include_math_h_ */

--part1_1cd.fda5102.2c7e5b12_boundary--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019