Small change and removed unnecessary files

svn path=/trunk/; revision=1200
This commit is contained in:
Jason Filby 2000-06-18 12:29:32 +00:00
parent 943db2de5a
commit e3b8762528
46 changed files with 4 additions and 1380 deletions

View file

@ -32,10 +32,12 @@ VOID STDCALL EngFreeMem(PVOID Mem)
PVOID STDCALL EngAllocUserMem(ULONG cj, ULONG tag)
{
PVOID newMem;
/* PVOID newMem;
/* return ZwAllocateVirtualMemory(mycurrentprocess, newMem, 0, cj,
return ZwAllocateVirtualMemory(mycurrentprocess, newMem, 0, cj,
MEM_COMMIT, PAGE_READWRITE); */
return NULL;
}
VOID STDCALL EngFreeUserMem(PVOID pv)

View file

@ -1,13 +0,0 @@
#include <crtdll/float.h>
#include <crtdll/internal/ieee.h>
double _chgsign( double __x )
{
double_t *x = (double_t *)&x;
if ( x->sign == 1 )
x->sign = 0;
else
x->sign = 1;
return __x;
}

View file

@ -1,13 +0,0 @@
#include <crtdll/float.h>
unsigned int _clearfp (void)
{
unsigned short __res = _statusfp();
__asm__ __volatile__ (
"fclex \n\t"
);
return __res;
}

View file

@ -1,38 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/float.h>
unsigned int _controlfp (unsigned int unNew, unsigned int unMask)
{
return _control87(unNew,unMask);
}
unsigned int _control87 (unsigned int unNew, unsigned int unMask)
{
register unsigned int __res;
__asm__ __volatile__ (
"pushl %%eax \n\t" /* make room on stack */
"fstcw (%%esp) \n\t"
"fwait \n\t"
"popl %%eax \n\t"
"andl $0xffff, %%eax \n\t" /* OK; we have the old value ready */
"movl %1, %%ecx \n\t"
"notl %%ecx \n\t"
"andl %%eax, %%ecx \n\t" /* the bits we want to keep */
"movl %2, %%edx \n\t"
"andl %1, %%edx \n\t" /* the bits we want to change */
"orl %%ecx, %%edx\n\t" /* the new value */
"pushl %%edx \n\t"
"fldcw (%%esp) \n\t"
"popl %%edx \n\t"
:"=r" (__res):"r" (unNew),"r" (unMask): "ax", "dx", "cx");
/* :"=a" (__res):"c" (unNew),"d" (unMask):"ax", "dx", "cx"); */
return __res;
}

View file

@ -1,13 +0,0 @@
#include <crtdll/float.h>
#include <crtdll/internal/ieee.h>
double _copysign (double __d, double __s)
{
double_t *d = (double_t *)&__d;
double_t *s = (double_t *)&__s;
d->sign = s->sign;
return __d;
}

View file

@ -1,65 +0,0 @@
#include <crtdll/float.h>
#include <crtdll/math.h>
#include <crtdll/internal/ieee.h>
#define _FPCLASS_SNAN 0x0001 /* signaling NaN */
#define _FPCLASS_QNAN 0x0002 /* quiet NaN */
#define _FPCLASS_NINF 0x0004 /* negative infinity */
#define _FPCLASS_NN 0x0008 /* negative normal */
#define _FPCLASS_ND 0x0010 /* negative denormal */
#define _FPCLASS_NZ 0x0020 /* -0 */
#define _FPCLASS_PZ 0x0040 /* +0 */
#define _FPCLASS_PD 0x0080 /* positive denormal */
#define _FPCLASS_PN 0x0100 /* positive normal */
#define _FPCLASS_PINF 0x0200 /* positive infinity */
#define FP_SNAN 0x0001 // signaling NaN
#define FP_QNAN 0x0002 // quiet NaN
#define FP_NINF 0x0004 // negative infinity
#define FP_PINF 0x0200 // positive infinity
#define FP_NDENORM 0x0008 // negative denormalized non-zero
#define FP_PDENORM 0x0010 // positive denormalized non-zero
#define FP_NZERO 0x0020 // negative zero
#define FP_PZERO 0x0040 // positive zero
#define FP_NNORM 0x0080 // negative normalized non-zero
#define FP_PNORM 0x0100 // positive normalized non-zero
typedef int fpclass_t;
fpclass_t _fpclass(double __d)
{
double_t *d = (double_t *)&__d;
if ( d->exponent == 0 ) {
if ( d->mantissah == 0 && d->mantissal == 0 ) {
if ( d->sign ==0 )
return FP_NZERO;
else
return FP_PZERO;
} else {
if ( d->sign ==0 )
return FP_NDENORM;
else
return FP_PDENORM;
}
}
if (d->exponent == 0x7ff ) {
if ( d->mantissah == 0 && d->mantissal == 0 ) {
if ( d->sign ==0 )
return FP_NINF;
else
return FP_PINF;
}
else if ( d->mantissah == 0 && d->mantissal != 0 ) {
return FP_QNAN;
}
else if ( d->mantissah == 0 && d->mantissal != 0 ) {
return FP_SNAN;
}
}
return 0;
}

View file

@ -1,8 +0,0 @@
#include <crtdll/float.h>
void _fpreset (void)
{
/* FIXME: This causes an exception */
// __asm__ __volatile__("fninit\n\t");
return;
}

View file

@ -1,77 +0,0 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <crtdll/math.h>
#include <crtdll/float.h>
#include <crtdll/internal/ieee.h>
int _isnan(double __x)
{
double_t * x = (double_t *)&__x;
return ( x->exponent == 0x7ff && ( x->mantissah != 0 || x->mantissal != 0 ));
}
int _isnanl(long double __x)
{
/* Intel's extended format has the normally implicit 1 explicit
present. Sigh! */
long_double_t * x = (long_double_t *)&__x;
/* IEEE 854 NaN's have the maximum possible
exponent and a nonzero mantissa. */
return (( x->exponent == 0x7fff)
&& ( (x->mantissah & 0x80000000) != 0)
&& ( (x->mantissah & (unsigned int)0x7fffffff) != 0 || x->mantissal != 0 ));
}
int _isinf(double __x)
{
double_t * x = (double_t *)&__x;
return ( x->exponent == 0x7ff && ( x->mantissah == 0 && x->mantissal == 0 ));
}
int _finite( double x )
{
return !_isinf(x);
}
int _isinfl(long double __x)
{
/* Intel's extended format has the normally implicit 1 explicit
present. Sigh! */
long_double_t * x = (long_double_t *)&__x;
/* An IEEE 854 infinity has an exponent with the
maximum possible value and a zero mantissa. */
if ( x->exponent == 0x7fff && ( (x->mantissah == 0x80000000 ) && x->mantissal == 0 ))
return x->sign ? -1 : 1;
return 0;
}

View file

@ -1,31 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double _logb (double __x);
double _logb (double __x)
{
register double __value, __junk;
__asm __volatile__
("fxtract\n\t"
: "=t" (__junk), "=u" (__value) : "0" (__x));
return __value;
}

View file

@ -1,12 +0,0 @@
#include <crtdll/float.h>
double _nextafter( double x, double y )
{
if ( x == y)
return x;
if ( isnan(x) || isnan(y) )
return x;
return x;
}

View file

@ -1,48 +0,0 @@
#define MAX_DOUBLE 1.7976931348623158e+308
#define MIN_DOUBLE 2.2250738585072014e-308
double _xnextafter( double __x, double __y )
{
double_t *x = ( double_t *)&__x;
double __e;
double_t *e = (double_t *)&__e;
if ( _isnan(__x) || _isinf(__x) )
return __x;
if ( _isnan(__y) )
return __y;
// don't go to infinity just by adding
if ( _isinf(__y) && fabs(__x) >= MAX_DOUBLE )
return __x;
if ( !_isinf(__y) && fabs(__x - __y) <= MIN_DOUBLE )
return __y;
e->mantissal = 1;
e->mantissah = 0;
if ( x->exponent >= 53 )
e->exponent = x->exponent - 52;
else
e->exponent = 1;
if ( fabs(__x) < fabs(__y) )
e->sign = 0;
else
e->sign = 1;
return __x+__e;
}

View file

@ -1,12 +0,0 @@
#include <crtdll/float.h>
#include <crtdll/internal/ieee.h>
double _scalb( double __x, long e )
{
double_t *x = (double_t *)&__x;
x->exponent += e;
return __x;
}

View file

@ -1,14 +0,0 @@
#include <crtdll/float.h>
unsigned int _statusfp (void)
{
register unsigned short __res;
__asm__ __volatile__ (
"fstsw %0 \n\t"
// "movzwl %ax, %eax"
:"=a" (__res)
);
return __res;
}

View file

@ -1,26 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <crtdll/math.h>
double acos (double __x)
{
return atan2 (sqrt (1.0 - __x * __x), __x);
}

View file

@ -1,8 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/math.h>
double
acosh(double x)
{
return log(x + sqrt(x*x - 1));
}

View file

@ -1,26 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <crtdll/math.h>
double asin (double __x)
{
return atan2 (__x, sqrt (1.0 - __x * __x));
}

View file

@ -1,9 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/math.h>
double
asinh(double x)
{
return x>0 ? log(x + sqrt(x*x + 1)) : -log(sqrt(x*x+1)-x);
}

View file

@ -1,32 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double atan (double __x);
double atan (double __x)
{
register double __value;
__asm __volatile__
("fld1\n\t"
"fpatan"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,12 +0,0 @@
double atan2 (double __y, double __x);
double atan2 (double __y, double __x)
{
register double __value;
__asm __volatile__
("fpatan\n\t"
"fld %%st(0)"
: "=t" (__value) : "0" (__x), "u" (__y));
return __value;
}

View file

@ -1,8 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/math.h>
double
atanh(double x)
{
return log((1+x)/(1-x)) / 2.0;
}

View file

@ -1,11 +0,0 @@
#include <crtdll/math.h>
double _cabs( struct _complex z )
{
return sqrt( z.x*z.x + z.y*z.y );
// return hypot(z.x,z.y);
}

View file

@ -1,23 +0,0 @@
#include <crtdll/math.h>
double ceil (double __x);
double ceil (double __x)
{
register double __value;
__volatile unsigned short int __cw, __cwtmp;
__asm __volatile ("fnstcw %0" : "=m" (__cw));
__cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */
__asm __volatile ("fldcw %0" : : "m" (__cwtmp));
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
__asm __volatile ("fldcw %0" : : "m" (__cw));
return __value;
}
long double ceill (long double __x)
{
return floor(__x)+1;
}

View file

@ -1,11 +0,0 @@
double cos (double __x);
double cos (double __x)
{
register double __value;
__asm __volatile__
("fcos"
: "=t" (__value): "0" (__x));
return __value;
}

View file

@ -1,8 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/math.h>
double cosh(double x)
{
const double ebig = exp(fabs(x));
return (ebig + 1.0/ebig) / 2.0;
}

View file

@ -1,42 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double exp (double __x);
double exp (double __x)
{
register double __value, __exponent;
__asm __volatile__
("fldl2e # e^x = 2^(x * log2(e))\n\t"
"fmul %%st(1) # x * log2(e)\n\t"
"fst %%st(1)\n\t"
"frndint # int(x * log2(e))\n\t"
"fxch\n\t"
"fsub %%st(1) # fract(x * log2(e))\n\t"
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
: "=t" (__value), "=u" (__exponent) : "0" (__x));
__value += 1.0;
__asm __volatile__
("fscale"
: "=t" (__value) : "0" (__value), "u" (__exponent));
return __value;
}

View file

@ -1,32 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double fabs (double __x);
double fabs (double __x)
{
register double __value;
__asm __volatile__
("fabs"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,50 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double floor (double __x);
double floor (double __x)
{
register double __value;
__volatile unsigned short int __cw, __cwtmp;
__asm __volatile ("fnstcw %0" : "=m" (__cw));
__cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */
__asm __volatile ("fldcw %0" : : "m" (__cwtmp));
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
__asm __volatile ("fldcw %0" : : "m" (__cw));
return __value;
}
typedef struct IEEExp {
unsigned manl:32;
unsigned manh:32;
unsigned exp:15;
unsigned sign:1;
} long_double_t;
long double floorl(long double x )
{
return (long double)(long long int)x;
}

View file

@ -1,35 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double fmod (double __x, double __y);
double fmod (double __x, double __y)
{
register double __value;
__asm __volatile__
("1: fprem\n\t"
"fstsw %%ax\n\t"
"sahf\n\t"
"jp 1b"
: "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc");
return __value;
}

View file

@ -1,20 +0,0 @@
#include <crtdll/math.h>
#include <crtdll/stdlib.h>
#include <crtdll/internal/ieee.h>
double
frexp(double __x, int *exptr)
{
double_t *x = (double_t *)&__x;
if ( exptr != NULL )
*exptr = x->exponent - 0x3FE;
x->exponent = 0x3FE;
return __x;
}

View file

@ -1,5 +0,0 @@
#include <crtdll/float.h>
long _ftol(double fl) {
return (long)fl;
}

View file

@ -1,7 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/internal/ieee.h>
#undef _HUGE
double_t _HUGE = { 0x00000, 0x00000, 0x7ff, 0x0 };
double *_HUGE_dll = (double *)&_HUGE;

View file

@ -1,98 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
/*
* hypot() function for DJGPP.
*
* hypot() computes sqrt(x^2 + y^2). The problem with the obvious
* naive implementation is that it might fail for very large or
* very small arguments. For instance, for large x or y the result
* might overflow even if the value of the function should not,
* because squaring a large number might trigger an overflow. For
* very small numbers, their square might underflow and will be
* silently replaced by zero; this won't cause an exception, but might
* have an adverse effect on the accuracy of the result.
*
* This implementation tries to avoid the above pitfals, without
* inflicting too much of a performance hit.
*
*/
#include <crtdll/float.h>
#include <crtdll/math.h>
#include <crtdll/errno.h>
/* Approximate square roots of DBL_MAX and DBL_MIN. Numbers
between these two shouldn't neither overflow nor underflow
when squared. */
#define __SQRT_DBL_MAX 1.3e+154
#define __SQRT_DBL_MIN 2.3e-162
double
_hypot(double x, double y)
{
double abig = fabs(x), asmall = fabs(y);
double ratio;
/* Make abig = max(|x|, |y|), asmall = min(|x|, |y|). */
if (abig < asmall)
{
double temp = abig;
abig = asmall;
asmall = temp;
}
/* Trivial case. */
if (asmall == 0.)
return abig;
/* Scale the numbers as much as possible by using its ratio.
For example, if both ABIG and ASMALL are VERY small, then
X^2 + Y^2 might be VERY inaccurate due to loss of
significant digits. Dividing ASMALL by ABIG scales them
to a certain degree, so that accuracy is better. */
if ((ratio = asmall / abig) > __SQRT_DBL_MIN && abig < __SQRT_DBL_MAX)
return abig * sqrt(1.0 + ratio*ratio);
else
{
/* Slower but safer algorithm due to Moler and Morrison. Never
produces any intermediate result greater than roughly the
larger of X and Y. Should converge to machine-precision
accuracy in 3 iterations. */
double r = ratio*ratio, t, s, p = abig, q = asmall;
do {
t = 4. + r;
if (t == 4.)
break;
s = r / t;
p += 2. * s * p;
q *= s;
r = (q / p) * (q / p);
} while (1);
return p;
}
}
#ifdef TEST
#include <crtdll/stdio.h>
int
main(void)
{
printf("hypot(3, 4) =\t\t\t %25.17e\n", _hypot(3., 4.));
printf("hypot(3*10^150, 4*10^150) =\t %25.17g\n", _hypot(3.e+150, 4.e+150));
printf("hypot(3*10^306, 4*10^306) =\t %25.17g\n", _hypot(3.e+306, 4.e+306));
printf("hypot(3*10^-320, 4*10^-320) =\t %25.17g\n",_hypot(3.e-320, 4.e-320));
printf("hypot(0.7*DBL_MAX, 0.7*DBL_MAX) =%25.17g\n",_hypot(0.7*DBL_MAX, 0.7*DBL_MAX));
printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", _hypot(DBL_MAX, 1.0));
printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", _hypot(1.0, DBL_MAX));
printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", _hypot(0.0, DBL_MAX));
return 0;
}
#endif

View file

@ -1,11 +0,0 @@
#include <crtdll/math.h>
double _j0(double x)
{
return x;
}
double _y0(double x)
{
return x;
}

View file

@ -1,11 +0,0 @@
#include <crtdll/math.h>
double _j1(double x)
{
return x;
}
double _y1(double x)
{
return x;
}

View file

@ -1,11 +0,0 @@
#include <crtdll/math.h>
double _jn(int n, double x)
{
return x;
}
double _yn(int n, double x)
{
return x;
}

View file

@ -1,31 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double ldexp (double __x, int __y);
double ldexp (double __x, int __y)
{
register double __value;
__asm __volatile__
("fscale"
: "=t" (__value) : "0" (__x), "u" ((double) __y));
return __value;
}

View file

@ -1,33 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double log (double __x);
double log (double __x)
{
register double __value;
__asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,34 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double log10 (double __x);
double log10 (double __x)
{
register double __value;
__asm __volatile__
("fldlg2\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,141 +0,0 @@
/* @(#)s_modf.c 1.3 95/01/18 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include <crtdll/float.h>
#include <crtdll/math.h>
#include <crtdll/internal/ieee.h>
//static const double one = 1.0;
double modf(double __x, double *__i)
{
double_t * x = (double_t *)&__x;
double_t * iptr = ( double_t *)__i;
int j0;
unsigned int i;
j0 = x->exponent - 0x3ff; /* exponent of x */
if(j0<20) { /* integer part in high x */
if(j0<0) { /* |x|<1 */
*__i = 0.0;
iptr->sign = x->sign;
return __x;
} else {
if ( x->mantissah == 0 && x->mantissal == 0 ) {
*__i = __x;
return 0.0;
}
i = (0x000fffff)>>j0;
iptr->sign = x->sign;
iptr->exponent = x->exponent;
iptr->mantissah = x->mantissah&(~i);
iptr->mantissal = 0;
if ( __x == *__i ) {
__x = 0.0;
x->sign = iptr->sign;
return __x;
}
return __x - *__i;
}
} else if (j0>51) { /* no fraction part */
*__i = __x;
if ( _isnan(__x) || _isinf(__x) )
return __x;
__x = 0.0;
x->sign = iptr->sign;
return __x;
} else { /* fraction part in low x */
i = ((unsigned)(0xffffffff))>>(j0-20);
iptr->sign = x->sign;
iptr->exponent = x->exponent;
iptr->mantissah = x->mantissah;
iptr->mantissal = x->mantissal&(~i);
if ( __x == *__i ) {
__x = 0.0;
x->sign = iptr->sign;
return __x;
}
return __x - *__i;
}
}
long double modfl(long double __x, long double *__i)
{
long_double_t * x = (long_double_t *)&__x;
long_double_t * iptr = (long_double_t *)__i;
int j0;
unsigned int i;
j0 = x->exponent - 0x3fff; /* exponent of x */
if(j0<32) { /* integer part in high x */
if(j0<0) { /* |x|<1 */
*__i = 0.0L;
iptr->sign = x->sign;
return __x;
} else {
i = ((unsigned int)(0xffffffff))>>(j0+1);
if ( x->mantissal == 0 && (x->mantissal & i) == 0 ) {
*__i = __x;
__x = 0.0L;
x->sign = iptr->sign;
return __x;
}
iptr->sign = x->sign;
iptr->exponent = x->exponent;
iptr->mantissah = x->mantissah&((~i));
iptr->mantissal = 0;
return __x - *__i;
}
} else if (j0>63) { /* no fraction part */
*__i = __x;
if ( _isnanl(__x) || _isinfl(__x) )
return __x;
__x = 0.0L;
x->sign = iptr->sign;
return __x;
} else { /* fraction part in low x */
i = ((unsigned int)(0xffffffff))>>(j0-32);
if ( x->mantissal == 0 ) {
*__i = __x;
__x = 0.0L;
x->sign = iptr->sign;
return __x;
}
iptr->sign = x->sign;
iptr->exponent = x->exponent;
iptr->mantissah = x->mantissah;
iptr->mantissal = x->mantissal&(~i);
return __x - *__i;
}
}

View file

@ -1,85 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double pow (double __x, double __y);
double __log2 (double __x);
double __log2 (double __x)
{
register double __value;
__asm __volatile__
("fld1\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (__value) : "0" (__x));
return __value;
}
double pow (double __x, double __y)
{
register double __value, __exponent;
long __p = (long) __y;
if (__x == 0.0 && __y > 0.0)
return 0.0;
if (__y == (double) __p)
{
double __r = 1.0;
if (__p == 0)
return 1.0;
if (__p < 0)
{
__p = -__p;
__x = 1.0 / __x;
}
while (1)
{
if (__p & 1)
__r *= __x;
__p >>= 1;
if (__p == 0)
return __r;
__x *= __x;
}
/* NOTREACHED */
}
__asm __volatile__
("fmul %%st(1) # y * log2(x)\n\t"
"fst %%st(1)\n\t"
"frndint # int(y * log2(x))\n\t"
"fxch\n\t"
"fsub %%st(1) # fract(y * log2(x))\n\t"
"f2xm1 # 2^(fract(y * log2(x))) - 1\n\t"
: "=t" (__value), "=u" (__exponent) : "0" (__log2 (__x)), "1" (__y));
__value += 1.0;
__asm __volatile__
("fscale"
: "=t" (__value) : "0" (__value), "u" (__exponent));
return __value;
}
long double powl (long double __x,long double __y)
{
return pow(__x,__y/2)*pow(__x,__y/2);
}

View file

@ -1,32 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double sin (double __x);
double sin (double __x)
{
register double __value;
__asm __volatile__
("fsin"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,16 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/math.h>
double sinh(double x)
{
if(x >= 0.0)
{
const double epos = exp(x);
return (epos - 1.0/epos) / 2.0;
}
else
{
const double eneg = exp(-x);
return (1.0/eneg - eneg) / 2.0;
}
}

View file

@ -1,32 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double sqrt (double __x);
double sqrt (double __x)
{
register double __value;
__asm __volatile__
("fsqrt"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,84 +0,0 @@
#include <crtdll/math.h>
double _CIsin (double x);
double _CIcos (double x);
double _CItan (double x);
double _CIsinh (double x);
double _CIcosh (double x);
double _CItanh (double x);
double _CIasin (double x);
double _CIacos (double x);
double _CIatan (double x);
double _CIatan2 (double y, double x);
double _CIexp (double x);
double _CIlog (double x);
double _CIlog10 (double x);
double _CIpow (double x, double y);
double _CIsqrt (double x);
double _CIfmod (double x, double y);
double _CIsin (double x)
{
return sin(x);
}
double _CIcos (double x)
{
return cos(x);
}
double _CItan (double x)
{
return tan(x);
}
double _CIsinh (double x)
{
return sinh(x);
}
double _CIcosh (double x)
{
return cosh(x);
}
double _CItanh (double x)
{
return tanh(x);
}
double _CIasin (double x)
{
return asin(x);
}
double _CIacos (double x)
{
return acos(x);
}
double _CIatan (double x)
{
return atan(x);
}
double _CIatan2 (double y, double x)
{
return atan2(y,x);
}
double _CIexp (double x)
{
return exp(x);
}
double _CIlog (double x)
{
return log(x);
}
double _CIlog10 (double x)
{
return log10(x);
}
double _CIpow (double x, double y)
{
return pow(x,y);
}
double _CIsqrt (double x)
{
return sqrt(x);
}
double _CIfmod (double x, double y)
{
return fmod(x,y);
}

View file

@ -1,33 +0,0 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double tan (double __x);
double tan (double __x)
{
register double __value;
register double __value2 __attribute__ ((unused));
__asm __volatile__
("fptan"
: "=t" (__value2), "=u" (__value) : "0" (__x));
return __value;
}

View file

@ -1,17 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/math.h>
double tanh(double x)
{
if (x > 50)
return 1;
else if (x < -50)
return -1;
else
{
const double ebig = exp(x);
const double esmall = 1.0/ebig;
return (ebig - esmall) / (ebig + esmall);
}
}