added some x86 glibc functions (more to come)
we might miss some wrappers for some ieee754 functions (to check) hope nothing is broken git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14968 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,6 +5,5 @@ KernelMergeObject posix_arch_$(TARGET_ARCH).o :
|
||||
setjmp_save_sigs.c
|
||||
sigsetjmp.S
|
||||
siglongjmp.S
|
||||
|
||||
: -fPIC -DPIC
|
||||
;
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
SubDir HAIKU_TOP src system libroot posix arch x86 ;
|
||||
SubDir HAIKU_TOP src system libroot posix arch ppc ;
|
||||
|
||||
KernelMergeObject posix_arch_$(TARGET_ARCH).o :
|
||||
setjmp.c
|
||||
setjmp_save_sigs.c
|
||||
sigsetjmp.S
|
||||
siglongjmp.S
|
||||
|
||||
s_ceilf.c
|
||||
s_floorf.c
|
||||
s_fpclassify.c
|
||||
s_fpclassifyf.c
|
||||
s_fpclassifyl.c
|
||||
: -fPIC -DPIC
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles
|
||||
s_fpclassify.c s_fpclassifyf.c s_fpclassifyl.c
|
||||
] = [ FDirName $(SUBDIR) $(DOTDOT) ] ;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/* s_ceilf.c -- float version of s_ceil.c.
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: s_ceilf.c,v 1.4 1995/05/10 20:46:55 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
static const float huge = 1.0e30;
|
||||
#else
|
||||
static float huge = 1.0e30;
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
float __ceilf(float x)
|
||||
#else
|
||||
float __ceilf(x)
|
||||
float x;
|
||||
#endif
|
||||
{
|
||||
int32_t i0,j0;
|
||||
u_int32_t i;
|
||||
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
j0 = ((i0>>23)&0xff)-0x7f;
|
||||
if(j0<23) {
|
||||
if(j0<0) { /* raise inexact if x != 0 */
|
||||
if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */
|
||||
if(i0<0) {i0=0x80000000;}
|
||||
else if(i0!=0) { i0=0x3f800000;}
|
||||
}
|
||||
} else {
|
||||
i = (0x007fffff)>>j0;
|
||||
if((i0&i)==0) return x; /* x is integral */
|
||||
if(huge+x>(float)0.0) { /* raise inexact flag */
|
||||
if(i0>0) i0 += (0x00800000)>>j0;
|
||||
i0 &= (~i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(j0==0x80) return x+x; /* inf or NaN */
|
||||
else return x; /* x is integral */
|
||||
}
|
||||
SET_FLOAT_WORD(x,i0);
|
||||
return x;
|
||||
}
|
||||
weak_alias (__ceilf, ceilf)
|
||||
@@ -0,0 +1,71 @@
|
||||
/* s_floorf.c -- float version of s_floor.c.
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: s_floorf.c,v 1.4 1995/05/10 20:47:22 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* floorf(x)
|
||||
* Return x rounded toward -inf to integral value
|
||||
* Method:
|
||||
* Bit twiddling.
|
||||
* Exception:
|
||||
* Inexact flag raised if x not equal to floorf(x).
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
static const float huge = 1.0e30;
|
||||
#else
|
||||
static float huge = 1.0e30;
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
float __floorf(float x)
|
||||
#else
|
||||
float __floorf(x)
|
||||
float x;
|
||||
#endif
|
||||
{
|
||||
int32_t i0,j0;
|
||||
u_int32_t i;
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
j0 = ((i0>>23)&0xff)-0x7f;
|
||||
if(j0<23) {
|
||||
if(j0<0) { /* raise inexact if x != 0 */
|
||||
if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */
|
||||
if(i0>=0) {i0=0;}
|
||||
else if((i0&0x7fffffff)!=0)
|
||||
{ i0=0xbf800000;}
|
||||
}
|
||||
} else {
|
||||
i = (0x007fffff)>>j0;
|
||||
if((i0&i)==0) return x; /* x is integral */
|
||||
if(huge+x>(float)0.0) { /* raise inexact flag */
|
||||
if(i0<0) i0 += (0x00800000)>>j0;
|
||||
i0 &= (~i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(j0==0x80) return x+x; /* inf or NaN */
|
||||
else return x; /* x is integral */
|
||||
}
|
||||
SET_FLOAT_WORD(x,i0);
|
||||
return x;
|
||||
}
|
||||
weak_alias (__floorf, floorf)
|
||||
@@ -0,0 +1,43 @@
|
||||
/* Return classification value corresponding to argument.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
int
|
||||
__fpclassify (double x)
|
||||
{
|
||||
u_int32_t hx, lx;
|
||||
int retval = FP_NORMAL;
|
||||
|
||||
EXTRACT_WORDS (hx, lx, x);
|
||||
lx |= hx & 0xfffff;
|
||||
hx &= 0x7ff00000;
|
||||
if ((hx | lx) == 0)
|
||||
retval = FP_ZERO;
|
||||
else if (hx == 0)
|
||||
retval = FP_SUBNORMAL;
|
||||
else if (hx == 0x7ff00000)
|
||||
retval = lx != 0 ? FP_NAN : FP_INFINITE;
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/* Return classification value corresponding to argument.
|
||||
Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
int
|
||||
__fpclassifyf (float x)
|
||||
{
|
||||
u_int32_t wx;
|
||||
int retval = FP_NORMAL;
|
||||
|
||||
GET_FLOAT_WORD (wx, x);
|
||||
wx &= 0x7fffffff;
|
||||
if (wx == 0)
|
||||
retval = FP_ZERO;
|
||||
else if (wx < 0x800000)
|
||||
retval = FP_SUBNORMAL;
|
||||
else if (wx >= 0x7f800000)
|
||||
retval = wx > 0x7f800000 ? FP_NAN : FP_INFINITE;
|
||||
|
||||
return retval;
|
||||
}
|
||||
libm_hidden_def (__fpclassifyf)
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Return classification value corresponding to argument.
|
||||
Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1997 and
|
||||
Jakub Jelinek <[email protected]>, 1999.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
int
|
||||
__fpclassifyl (long double x)
|
||||
{
|
||||
u_int64_t hx, lx;
|
||||
int retval = FP_NORMAL;
|
||||
|
||||
GET_LDOUBLE_WORDS64 (hx, lx, x);
|
||||
lx |= (hx & 0x0000ffffffffffffLL);
|
||||
hx &= 0x7fff000000000000LL;
|
||||
if ((hx | lx) == 0)
|
||||
retval = FP_ZERO;
|
||||
else if (hx == 0)
|
||||
retval = FP_SUBNORMAL;
|
||||
else if (hx == 0x7fff000000000000LL)
|
||||
retval = lx != 0 ? FP_NAN : FP_INFINITE;
|
||||
|
||||
return retval;
|
||||
}
|
||||
libm_hidden_def (__fpclassifyl)
|
||||
@@ -0,0 +1,85 @@
|
||||
/* @(#)s_modf.c 5.1 93/09/24 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: s_modf.c,v 1.8 1995/05/10 20:47:55 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* modf(double x, double *iptr)
|
||||
* return fraction part of x, and return x's integral part in *iptr.
|
||||
* Method:
|
||||
* Bit twiddling.
|
||||
*
|
||||
* Exception:
|
||||
* No exception.
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
static const double one = 1.0;
|
||||
#else
|
||||
static double one = 1.0;
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
double __modf(double x, double *iptr)
|
||||
#else
|
||||
double __modf(x, iptr)
|
||||
double x,*iptr;
|
||||
#endif
|
||||
{
|
||||
int32_t i0,i1,j0;
|
||||
u_int32_t i;
|
||||
EXTRACT_WORDS(i0,i1,x);
|
||||
j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */
|
||||
if(j0<20) { /* integer part in high x */
|
||||
if(j0<0) { /* |x|<1 */
|
||||
INSERT_WORDS(*iptr,i0&0x80000000,0); /* *iptr = +-0 */
|
||||
return x;
|
||||
} else {
|
||||
i = (0x000fffff)>>j0;
|
||||
if(((i0&i)|i1)==0) { /* x is integral */
|
||||
*iptr = x;
|
||||
INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */
|
||||
return x;
|
||||
} else {
|
||||
INSERT_WORDS(*iptr,i0&(~i),0);
|
||||
return x - *iptr;
|
||||
}
|
||||
}
|
||||
} else if (j0>51) { /* no fraction part */
|
||||
*iptr = x*one;
|
||||
/* We must handle NaNs separately. */
|
||||
if (j0 == 0x400 && ((i0 & 0xfffff) | i1))
|
||||
return x*one;
|
||||
INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */
|
||||
return x;
|
||||
} else { /* fraction part in low x */
|
||||
i = ((u_int32_t)(0xffffffff))>>(j0-20);
|
||||
if((i1&i)==0) { /* x is integral */
|
||||
*iptr = x;
|
||||
INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */
|
||||
return x;
|
||||
} else {
|
||||
INSERT_WORDS(*iptr,i0,i1&(~i));
|
||||
return x - *iptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
weak_alias (__modf, modf)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__modf, __modfl)
|
||||
weak_alias (__modf, modfl)
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
/* s_modff.c -- float version of s_modf.c.
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: s_modff.c,v 1.4 1995/05/10 20:47:56 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
static const float one = 1.0;
|
||||
#else
|
||||
static float one = 1.0;
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
float __modff(float x, float *iptr)
|
||||
#else
|
||||
float __modff(x, iptr)
|
||||
float x,*iptr;
|
||||
#endif
|
||||
{
|
||||
int32_t i0,j0;
|
||||
u_int32_t i;
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
j0 = ((i0>>23)&0xff)-0x7f; /* exponent of x */
|
||||
if(j0<23) { /* integer part in x */
|
||||
if(j0<0) { /* |x|<1 */
|
||||
SET_FLOAT_WORD(*iptr,i0&0x80000000); /* *iptr = +-0 */
|
||||
return x;
|
||||
} else {
|
||||
i = (0x007fffff)>>j0;
|
||||
if((i0&i)==0) { /* x is integral */
|
||||
u_int32_t ix;
|
||||
*iptr = x;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */
|
||||
return x;
|
||||
} else {
|
||||
SET_FLOAT_WORD(*iptr,i0&(~i));
|
||||
return x - *iptr;
|
||||
}
|
||||
}
|
||||
} else { /* no fraction part */
|
||||
*iptr = x*one;
|
||||
/* We must handle NaNs separately. */
|
||||
if (j0 == 0x80 && (i0 & 0x7fffff))
|
||||
return x*one;
|
||||
SET_FLOAT_WORD(x,i0&0x80000000); /* return +-0 */
|
||||
return x;
|
||||
}
|
||||
}
|
||||
weak_alias (__modff, modff)
|
||||
@@ -0,0 +1,88 @@
|
||||
/* s_modfl.c -- long double version of s_modf.c.
|
||||
* Conversion to IEEE quad long double by Jakub Jelinek, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* modfl(long double x, long double *iptr)
|
||||
* return fraction part of x, and return x's integral part in *iptr.
|
||||
* Method:
|
||||
* Bit twiddling.
|
||||
*
|
||||
* Exception:
|
||||
* No exception.
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
static const long double one = 1.0;
|
||||
#else
|
||||
static long double one = 1.0;
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
long double __modfl(long double x, long double *iptr)
|
||||
#else
|
||||
long double __modfl(x, iptr)
|
||||
long double x,*iptr;
|
||||
#endif
|
||||
{
|
||||
int64_t i0,i1,j0;
|
||||
u_int64_t i;
|
||||
GET_LDOUBLE_WORDS64(i0,i1,x);
|
||||
j0 = ((i0>>48)&0x7fff)-0x3fff; /* exponent of x */
|
||||
if(j0<48) { /* integer part in high x */
|
||||
if(j0<0) { /* |x|<1 */
|
||||
/* *iptr = +-0 */
|
||||
SET_LDOUBLE_WORDS64(*iptr,i0&0x8000000000000000ULL,0);
|
||||
return x;
|
||||
} else {
|
||||
i = (0x0000ffffffffffffLL)>>j0;
|
||||
if(((i0&i)|i1)==0) { /* x is integral */
|
||||
*iptr = x;
|
||||
/* return +-0 */
|
||||
SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
|
||||
return x;
|
||||
} else {
|
||||
SET_LDOUBLE_WORDS64(*iptr,i0&(~i),0);
|
||||
return x - *iptr;
|
||||
}
|
||||
}
|
||||
} else if (j0>111) { /* no fraction part */
|
||||
*iptr = x*one;
|
||||
/* We must handle NaNs separately. */
|
||||
if (j0 == 0x4000 && ((i0 & 0x0000ffffffffffffLL) | i1))
|
||||
return x*one;
|
||||
/* return +-0 */
|
||||
SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
|
||||
return x;
|
||||
} else { /* fraction part in low x */
|
||||
i = -1ULL>>(j0-48);
|
||||
if((i1&i)==0) { /* x is integral */
|
||||
*iptr = x;
|
||||
/* return +-0 */
|
||||
SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
|
||||
return x;
|
||||
} else {
|
||||
SET_LDOUBLE_WORDS64(*iptr,i0,i1&(~i));
|
||||
return x - *iptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
weak_alias (__modfl, modfl)
|
||||
@@ -0,0 +1,47 @@
|
||||
/* @(#)w_atan2.c 5.1 93/09/24 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper atan2(y,x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
double __atan2(double y, double x) /* wrapper atan2 */
|
||||
#else
|
||||
double __atan2(y,x) /* wrapper atan2 */
|
||||
double y,x;
|
||||
#endif
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_atan2(y,x);
|
||||
#else
|
||||
double z;
|
||||
z = __ieee754_atan2(y,x);
|
||||
if(_LIB_VERSION != _SVID_||__isnan(x)||__isnan(y)) return z;
|
||||
if(x==0.0&&y==0.0)
|
||||
return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
|
||||
return z;
|
||||
#endif
|
||||
}
|
||||
weak_alias (__atan2, atan2)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__atan2, __atan2l)
|
||||
weak_alias (__atan2, atan2l)
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
/* w_atan2f.c -- float version of w_atan2.c.
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper atan2f(y,x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
float __atan2f(float y, float x) /* wrapper atan2f */
|
||||
#else
|
||||
float __atan2f(y,x) /* wrapper atan2 */
|
||||
float y,x;
|
||||
#endif
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_atan2f(y,x);
|
||||
#else
|
||||
float z;
|
||||
z = __ieee754_atan2f(y,x);
|
||||
if(_LIB_VERSION != _SVID_||__isnanf(x)||__isnanf(y)) return z;
|
||||
if(x==0.0&&y==0.0)
|
||||
return __kernel_standard(y,x,103); /* atan2(+-0,+-0) */
|
||||
return z;
|
||||
#endif
|
||||
}
|
||||
weak_alias (__atan2f, atan2f)
|
||||
@@ -0,0 +1,47 @@
|
||||
/* w_atan2l.c -- long double version of w_atan2.c.
|
||||
* Conversion to long double by Ulrich Drepper,
|
||||
* Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper atan2l(y,x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
long double __atan2l(long double y, long double x) /* wrapper atan2l */
|
||||
#else
|
||||
long double __atan2l(y,x) /* wrapper atan2l */
|
||||
long double y,x;
|
||||
#endif
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_atan2l(y,x);
|
||||
#else
|
||||
long double z;
|
||||
z = __ieee754_atan2l(y,x);
|
||||
if(_LIB_VERSION != _SVID_||__isnanl(x)||__isnanl(y)) return z;
|
||||
if(x==0.0&&y==0.0)
|
||||
return __kernel_standard(y,x,203); /* atan2(+-0,+-0) */
|
||||
return z;
|
||||
#endif
|
||||
}
|
||||
weak_alias (__atan2l, atan2l)
|
||||
@@ -0,0 +1,48 @@
|
||||
/* @(#)w_fmod.c 5.1 93/09/24 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper fmod(x,y)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
double __fmod(double x, double y) /* wrapper fmod */
|
||||
#else
|
||||
double __fmod(x,y) /* wrapper fmod */
|
||||
double x,y;
|
||||
#endif
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_fmod(x,y);
|
||||
#else
|
||||
double z;
|
||||
z = __ieee754_fmod(x,y);
|
||||
if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
|
||||
if(y==0.0) {
|
||||
return __kernel_standard(x,y,27); /* fmod(x,0) */
|
||||
} else
|
||||
return z;
|
||||
#endif
|
||||
}
|
||||
weak_alias (__fmod, fmod)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__fmod, __fmodl)
|
||||
weak_alias (__fmod, fmodl)
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
/* w_fmodf.c -- float version of w_fmod.c.
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper fmodf(x,y)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
float __fmodf(float x, float y) /* wrapper fmodf */
|
||||
#else
|
||||
float __fmodf(x,y) /* wrapper fmodf */
|
||||
float x,y;
|
||||
#endif
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_fmodf(x,y);
|
||||
#else
|
||||
float z;
|
||||
z = __ieee754_fmodf(x,y);
|
||||
if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
|
||||
if(y==(float)0.0) {
|
||||
/* fmodf(x,0) */
|
||||
return (float)__kernel_standard((double)x,(double)y,127);
|
||||
} else
|
||||
return z;
|
||||
#endif
|
||||
}
|
||||
weak_alias (__fmodf, fmodf)
|
||||
@@ -0,0 +1,48 @@
|
||||
/* w_fmodl.c -- long double version of w_fmod.c.
|
||||
* Conversion to long double by Ulrich Drepper,
|
||||
* Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#if defined(LIBM_SCCS) && !defined(lint)
|
||||
static char rcsid[] = "$NetBSD: $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper fmodl(x,y)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
long double __fmodl(long double x, long double y)/* wrapper fmodl */
|
||||
#else
|
||||
long double __fmodl(x,y) /* wrapper fmodl */
|
||||
long double x,y;
|
||||
#endif
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_fmodl(x,y);
|
||||
#else
|
||||
long double z;
|
||||
z = __ieee754_fmodl(x,y);
|
||||
if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
|
||||
if(y==0.0) {
|
||||
return __kernel_standard(x,y,227); /* fmod(x,0) */
|
||||
} else
|
||||
return z;
|
||||
#endif
|
||||
}
|
||||
weak_alias (__fmodl, fmodl)
|
||||
@@ -1,9 +1,9 @@
|
||||
SubDir HAIKU_TOP src system libroot posix glibc arch x86 ;
|
||||
|
||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch
|
||||
$(TARGET_ARCH) ;
|
||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch $(TARGET_ARCH) ;
|
||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include ;
|
||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdlib ;
|
||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc math ;
|
||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||
|
||||
if $(OPTIM) = -O0 {
|
||||
@@ -13,23 +13,72 @@ if $(OPTIM) = -O0 {
|
||||
# don't compile with debugging
|
||||
DEBUG = 0 ;
|
||||
|
||||
SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM ;
|
||||
|
||||
KernelMergeObject posix_gnu_arch_$(TARGET_ARCH).o :
|
||||
add_n.S
|
||||
addmul_1.S
|
||||
cmp.c
|
||||
dbl2mpn.c
|
||||
divrem.c
|
||||
e_acos.S
|
||||
e_atan2.S
|
||||
e_atan2f.S
|
||||
e_atan2l.c
|
||||
e_fmod.S
|
||||
e_fmodf.S
|
||||
e_fmodl.c
|
||||
ldbl2mpn.c
|
||||
mul.c
|
||||
mul_1.S
|
||||
mul_n.c
|
||||
lshift.S
|
||||
rshift.S
|
||||
s_ceil.S
|
||||
s_ceilf.S
|
||||
s_ceill.S
|
||||
s_copysign.S
|
||||
s_copysignf.S
|
||||
s_copysignl.S
|
||||
s_fdim.S
|
||||
s_fdimf.S
|
||||
s_fdiml.S
|
||||
s_fabs.S
|
||||
s_fabsf.S
|
||||
s_fabsl.S
|
||||
s_finite.S
|
||||
s_finitef.S
|
||||
s_finitel.S
|
||||
s_floor.S
|
||||
s_floorf.S
|
||||
s_floorl.S
|
||||
s_fpclassify.c
|
||||
s_fpclassifyf.c
|
||||
s_fpclassifyl.c
|
||||
s_logb.S
|
||||
s_logbf.S
|
||||
s_logbl.c
|
||||
s_modf.c
|
||||
s_modff.c
|
||||
s_modfl.c
|
||||
s_rint.S
|
||||
s_rintf.S
|
||||
s_rintl.c
|
||||
s_scalbn.S
|
||||
s_scalbnf.S
|
||||
s_scalbnl.S
|
||||
sub_n.S
|
||||
submul_1.S
|
||||
w_atan2.c
|
||||
w_atan2f.c
|
||||
w_atan2l.c
|
||||
w_fmod.c
|
||||
w_fmodf.c
|
||||
w_fmodl.c
|
||||
: -fPIC -DPIC
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles
|
||||
cmp.c divrem.c mul.c mul_n.c dbl2mpn.c
|
||||
cmp.c divrem.c mul.c mul_n.c dbl2mpn.c s_fpclassify.c s_fpclassifyf.c s_fpclassifyl.c s_modf.c s_modff.c s_modfl.c
|
||||
w_atan2.c w_atan2f.c w_atan2l.c w_fmod.c w_fmodl.c w_fmodf.c
|
||||
] = [ FDirName $(HAIKU_TOP) src system libroot posix glibc arch ] ;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: e_acos.S,v 1.4 1995/05/08 23:44:37 jtc Exp $")
|
||||
|
||||
/* acos = atan (sqrt(1 - x^2) / x) */
|
||||
ENTRY(__ieee754_acos)
|
||||
fldl 4(%esp) /* x */
|
||||
fld %st /* x : x */
|
||||
fmul %st(0) /* x^2 : x */
|
||||
fld1 /* 1 : x^2 : x */
|
||||
fsubp /* 1 - x^2 : x */
|
||||
fsqrt /* sqrt (1 - x^2) : x */
|
||||
fxch %st(1) /* x : sqrt (1 - x^2) */
|
||||
fpatan /* atan (sqrt(1 - x^2) / x) */
|
||||
ret
|
||||
END (__ieee754_acos)
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: e_atan2.S,v 1.4 1995/05/08 23:46:28 jtc Exp $")
|
||||
|
||||
ENTRY(__ieee754_atan2)
|
||||
fldl 4(%esp)
|
||||
fldl 12(%esp)
|
||||
fpatan
|
||||
ret
|
||||
END (__ieee754_atan2)
|
||||
|
||||
weak_alias (__ieee754_atan2, atan2)
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: e_atan2f.S,v 1.1 1995/05/08 23:35:10 jtc Exp $")
|
||||
|
||||
ENTRY(__ieee754_atan2f)
|
||||
flds 4(%esp)
|
||||
flds 8(%esp)
|
||||
fpatan
|
||||
ret
|
||||
END (__ieee754_atan2f)
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <[email protected]>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <[email protected]>.
|
||||
*/
|
||||
|
||||
#include <math_private.h>
|
||||
|
||||
long double
|
||||
__ieee754_atan2l (long double y, long double x)
|
||||
{
|
||||
long double res;
|
||||
|
||||
asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: e_fmod.S,v 1.4 1995/05/08 23:47:56 jtc Exp $")
|
||||
|
||||
ENTRY(__ieee754_fmod)
|
||||
fldl 12(%esp)
|
||||
fldl 4(%esp)
|
||||
1: fprem
|
||||
fstsw %ax
|
||||
sahf
|
||||
jp 1b
|
||||
fstp %st(1)
|
||||
ret
|
||||
END (__ieee754_fmod)
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
* Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__ieee754_fmodf)
|
||||
flds 8(%esp)
|
||||
flds 4(%esp)
|
||||
1: fprem
|
||||
fstsw %ax
|
||||
sahf
|
||||
jp 1b
|
||||
fstp %st(1)
|
||||
ret
|
||||
END(__ieee754_fmodf)
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <[email protected]>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <[email protected]>.
|
||||
*/
|
||||
|
||||
#include <math_private.h>
|
||||
|
||||
long double
|
||||
__ieee754_fmodl (long double x, long double y)
|
||||
{
|
||||
long double res;
|
||||
|
||||
asm ("1:\tfprem\n"
|
||||
"fstsw %%ax\n"
|
||||
"sahf\n"
|
||||
"jp 1b\n"
|
||||
"fstp %%st(1)"
|
||||
: "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
|
||||
return res;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $")
|
||||
|
||||
ENTRY(__ceil)
|
||||
fldl 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
END (__ceil)
|
||||
weak_alias (__ceil, ceil)
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $")
|
||||
|
||||
ENTRY(__ceilf)
|
||||
flds 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
END (__ceilf)
|
||||
weak_alias (__ceilf, ceilf)
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__ceill)
|
||||
fldt 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
END (__ceill)
|
||||
weak_alias (__ceill, ceill)
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_copysign.S,v 1.4 1995/05/08 23:53:02 jtc Exp $")
|
||||
|
||||
ENTRY(__copysign)
|
||||
movl 16(%esp),%edx
|
||||
movl 8(%esp),%eax
|
||||
andl $0x80000000,%edx
|
||||
andl $0x7fffffff,%eax
|
||||
orl %edx,%eax
|
||||
movl %eax,8(%esp)
|
||||
fldl 4(%esp)
|
||||
ret
|
||||
END (__copysign)
|
||||
weak_alias (__copysign, copysign)
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $")
|
||||
|
||||
ENTRY(__copysignf)
|
||||
movl 8(%esp),%edx
|
||||
movl 4(%esp),%eax
|
||||
andl $0x80000000,%edx
|
||||
andl $0x7fffffff,%eax
|
||||
orl %edx,%eax
|
||||
movl %eax,4(%esp)
|
||||
flds 4(%esp)
|
||||
ret
|
||||
END (__copysignf)
|
||||
weak_alias (__copysignf, copysignf)
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__copysignl)
|
||||
movl 24(%esp),%edx
|
||||
movl 12(%esp),%eax
|
||||
andl $0x8000,%edx
|
||||
andl $0x7fff,%eax
|
||||
orl %edx,%eax
|
||||
movl %eax,12(%esp)
|
||||
fldt 4(%esp)
|
||||
ret
|
||||
END (__copysignl)
|
||||
weak_alias (__copysignl, copysignl)
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
.text
|
||||
ENTRY(__fabs)
|
||||
fldl 4(%esp)
|
||||
fabs
|
||||
ret
|
||||
END(__fabs)
|
||||
weak_alias (__fabs, fabs)
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
.text
|
||||
ENTRY(__fabsf)
|
||||
flds 4(%esp)
|
||||
fabs
|
||||
ret
|
||||
END(__fabsf)
|
||||
weak_alias (__fabsf, fabsf)
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
.text
|
||||
ENTRY(__fabsl)
|
||||
fldt 4(%esp)
|
||||
fabs
|
||||
ret
|
||||
END(__fabsl)
|
||||
weak_alias (__fabsl, fabsl)
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Compute positive difference.
|
||||
Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
.text
|
||||
ENTRY(__fdim)
|
||||
fldl 4(%esp) // x
|
||||
fldl 12(%esp) // x : y
|
||||
|
||||
fucom %st(1)
|
||||
fnstsw
|
||||
sahf
|
||||
jp 1f
|
||||
|
||||
jc 3f
|
||||
|
||||
fstp %st(1)
|
||||
fldz
|
||||
jmp 2f
|
||||
|
||||
3: fsubrp %st, %st(1)
|
||||
ret
|
||||
|
||||
1: fxam
|
||||
fnstsw
|
||||
andb $0x45, %ah
|
||||
cmpb $0x01, %ah
|
||||
je 2f
|
||||
|
||||
fxch
|
||||
2: fstp %st(1)
|
||||
ret
|
||||
END(__fdim)
|
||||
weak_alias (__fdim, fdim)
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Compute positive difference.
|
||||
Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
.text
|
||||
ENTRY(__fdimf)
|
||||
flds 4(%esp) // x
|
||||
flds 8(%esp) // x : y
|
||||
|
||||
fucom %st(1)
|
||||
fnstsw
|
||||
sahf
|
||||
jp 1f
|
||||
|
||||
jc 3f
|
||||
|
||||
fstp %st(1)
|
||||
fldz
|
||||
jmp 2f
|
||||
|
||||
3: fsubrp %st, %st(1)
|
||||
ret
|
||||
|
||||
1: fxam
|
||||
fnstsw
|
||||
andb $0x45, %ah
|
||||
cmpb $0x01, %ah
|
||||
je 2f
|
||||
|
||||
fxch
|
||||
2: fstp %st(1)
|
||||
ret
|
||||
END(__fdimf)
|
||||
weak_alias (__fdimf, fdimf)
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Compute positive difference.
|
||||
Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
.text
|
||||
ENTRY(__fdiml)
|
||||
fldt 4(%esp) // x
|
||||
fldt 16(%esp) // x : y
|
||||
|
||||
fucom %st(1)
|
||||
fnstsw
|
||||
sahf
|
||||
jp 1f
|
||||
|
||||
jc 3f
|
||||
|
||||
fstp %st(1)
|
||||
fldz
|
||||
jmp 2f
|
||||
|
||||
3: fsubrp %st, %st(1)
|
||||
ret
|
||||
|
||||
1: fxam
|
||||
fnstsw
|
||||
andb $0x45, %ah
|
||||
cmpb $0x01, %ah
|
||||
je 2f
|
||||
|
||||
fxch
|
||||
2: fstp %st(1)
|
||||
ret
|
||||
END(__fdiml)
|
||||
weak_alias (__fdiml, fdiml)
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Written by Joe Keane <jgk@jgk.org>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__finite)
|
||||
movl 8(%esp),%eax
|
||||
movl $0xFFEFFFFF,%ecx
|
||||
subl %eax,%ecx
|
||||
xorl %ecx,%eax
|
||||
shrl $31, %eax
|
||||
ret
|
||||
END (__finite)
|
||||
weak_alias (__finite, finite)
|
||||
hidden_def (__finite)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Written by Joe Keane <jgk@jgk.org>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__finitef)
|
||||
movl 4(%esp),%eax
|
||||
movl $0xFF7FFFFF,%ecx
|
||||
subl %eax,%ecx
|
||||
xorl %ecx,%eax
|
||||
shrl $31,%eax
|
||||
ret
|
||||
END (__finitef)
|
||||
weak_alias (__finitef, finitef)
|
||||
hidden_def (__finitef)
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Written by Joe Keane <jgk@jgk.org>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__finitel)
|
||||
movl 12(%esp),%eax
|
||||
orl $0xffff8000, %eax
|
||||
incl %eax
|
||||
shrl $31, %eax
|
||||
ret
|
||||
END (__finitel)
|
||||
weak_alias (__finitel, finitel)
|
||||
hidden_def (__finitel)
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_floor.S,v 1.4 1995/05/09 00:01:59 jtc Exp $")
|
||||
|
||||
ENTRY(__floor)
|
||||
fldl 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
END (__floor)
|
||||
weak_alias (__floor, floor)
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $")
|
||||
|
||||
ENTRY(__floorf)
|
||||
flds 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
END (__floorf)
|
||||
weak_alias (__floorf, floorf)
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__floorl)
|
||||
fldt 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
END (__floorl)
|
||||
weak_alias (__floorl, floorl)
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_logb.S,v 1.4 1995/05/09 00:14:30 jtc Exp $")
|
||||
|
||||
ENTRY(__logb)
|
||||
fldl 4(%esp)
|
||||
fxtract
|
||||
fstp %st
|
||||
ret
|
||||
END (__logb)
|
||||
weak_alias (__logb, logb)
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_logbf.S,v 1.3 1995/05/09 00:15:12 jtc Exp $")
|
||||
|
||||
ENTRY(__logbf)
|
||||
flds 4(%esp)
|
||||
fxtract
|
||||
fstp %st
|
||||
ret
|
||||
END (__logbf)
|
||||
weak_alias (__logbf, logbf)
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <[email protected]>.
|
||||
* Changes for long double by Ulrich Drepper <[email protected]>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <math_private.h>
|
||||
|
||||
long double
|
||||
__logbl (long double x)
|
||||
{
|
||||
long double res;
|
||||
|
||||
asm ("fxtract\n"
|
||||
"fstp %%st" : "=t" (res) : "0" (x));
|
||||
return res;
|
||||
}
|
||||
|
||||
weak_alias (__logbl, logbl)
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_rint.S,v 1.4 1995/05/09 00:16:08 jtc Exp $")
|
||||
|
||||
ENTRY(__rint)
|
||||
fldl 4(%esp)
|
||||
frndint
|
||||
ret
|
||||
END (__rint)
|
||||
weak_alias (__rint, rint)
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_rintf.S,v 1.3 1995/05/09 00:17:22 jtc Exp $")
|
||||
|
||||
ENTRY(__rintf)
|
||||
flds 4(%esp)
|
||||
frndint
|
||||
ret
|
||||
END (__rintf)
|
||||
weak_alias (__rintf, rintf)
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <[email protected]>.
|
||||
* Changes for long double by Ulrich Drepper <[email protected]>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <math_private.h>
|
||||
|
||||
long double
|
||||
__rintl (long double x)
|
||||
{
|
||||
long double res;
|
||||
|
||||
asm ("frndint" : "=t" (res) : "0" (x));
|
||||
return res;
|
||||
}
|
||||
|
||||
weak_alias (__rintl, rintl)
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_scalbn.S,v 1.4 1995/05/09 00:19:06 jtc Exp $")
|
||||
|
||||
ENTRY(__scalbn)
|
||||
fildl 12(%esp)
|
||||
fldl 4(%esp)
|
||||
fscale
|
||||
fstp %st(1)
|
||||
ret
|
||||
END (__scalbn)
|
||||
weak_alias (__scalbn, scalbn)
|
||||
strong_alias (__scalbn, __scalbln)
|
||||
weak_alias (__scalbn, scalbln)
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_scalbnf.S,v 1.3 1995/05/09 00:19:59 jtc Exp $")
|
||||
|
||||
ENTRY(__scalbnf)
|
||||
fildl 8(%esp)
|
||||
flds 4(%esp)
|
||||
fscale
|
||||
fstp %st(1)
|
||||
ret
|
||||
END (__scalbnf)
|
||||
weak_alias (__scalbnf, scalbnf)
|
||||
strong_alias (__scalbnf, __scalblnf)
|
||||
weak_alias (__scalbnf, scalblnf)
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__scalbnl)
|
||||
fildl 16(%esp)
|
||||
fldt 4(%esp)
|
||||
fscale
|
||||
fstp %st(1)
|
||||
ret
|
||||
END (__scalbnl)
|
||||
weak_alias (__scalbnl, scalbnl)
|
||||
strong_alias (__scalbnl, __scalblnl)
|
||||
weak_alias (__scalbnl, scalblnl)
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef _MATH_PRIVATE_H_
|
||||
#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
|
||||
#endif
|
||||
|
||||
/* A union which permits us to convert between a long double and
|
||||
four 32 bit ints or two 64 bit ints. */
|
||||
|
||||
#if __FLOAT_WORD_ORDER == BIG_ENDIAN
|
||||
|
||||
typedef union
|
||||
{
|
||||
long double value;
|
||||
struct
|
||||
{
|
||||
u_int64_t msw;
|
||||
u_int64_t lsw;
|
||||
} parts64;
|
||||
struct
|
||||
{
|
||||
u_int32_t w0, w1, w2, w3;
|
||||
} parts32;
|
||||
} ieee854_long_double_shape_type;
|
||||
|
||||
#endif
|
||||
|
||||
#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
|
||||
|
||||
typedef union
|
||||
{
|
||||
long double value;
|
||||
struct
|
||||
{
|
||||
u_int64_t lsw;
|
||||
u_int64_t msw;
|
||||
} parts64;
|
||||
struct
|
||||
{
|
||||
u_int32_t w3, w2, w1, w0;
|
||||
} parts32;
|
||||
} ieee854_long_double_shape_type;
|
||||
|
||||
#endif
|
||||
|
||||
/* Get two 64 bit ints from a long double. */
|
||||
|
||||
#define GET_LDOUBLE_WORDS64(ix0,ix1,d) \
|
||||
do { \
|
||||
ieee854_long_double_shape_type qw_u; \
|
||||
qw_u.value = (d); \
|
||||
(ix0) = qw_u.parts64.msw; \
|
||||
(ix1) = qw_u.parts64.lsw; \
|
||||
} while (0)
|
||||
|
||||
/* Set a long double from two 64 bit ints. */
|
||||
|
||||
#define SET_LDOUBLE_WORDS64(d,ix0,ix1) \
|
||||
do { \
|
||||
ieee854_long_double_shape_type qw_u; \
|
||||
qw_u.parts64.msw = (ix0); \
|
||||
qw_u.parts64.lsw = (ix1); \
|
||||
(d) = qw_u.value; \
|
||||
} while (0)
|
||||
|
||||
/* Get the more significant 64 bits of a long double mantissa. */
|
||||
|
||||
#define GET_LDOUBLE_MSW64(v,d) \
|
||||
do { \
|
||||
ieee854_long_double_shape_type sh_u; \
|
||||
sh_u.value = (d); \
|
||||
(v) = sh_u.parts64.msw; \
|
||||
} while (0)
|
||||
|
||||
/* Set the more significant 64 bits of a long double mantissa from an int. */
|
||||
|
||||
#define SET_LDOUBLE_MSW64(d,v) \
|
||||
do { \
|
||||
ieee854_long_double_shape_type sh_u; \
|
||||
sh_u.value = (d); \
|
||||
sh_u.parts64.msw = (v); \
|
||||
(d) = sh_u.value; \
|
||||
} while (0)
|
||||
|
||||
/* Get the least significant 64 bits of a long double mantissa. */
|
||||
|
||||
#define GET_LDOUBLE_LSW64(v,d) \
|
||||
do { \
|
||||
ieee854_long_double_shape_type sh_u; \
|
||||
sh_u.value = (d); \
|
||||
(v) = sh_u.parts64.lsw; \
|
||||
} while (0)
|
||||
@@ -0,0 +1,10 @@
|
||||
/* The libm assembly code wants to include <machine/asm.h> to define the
|
||||
ENTRY macro. We define assembly-related macros in sysdep.h and
|
||||
asm-syntax.h. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <asm-syntax.h>
|
||||
|
||||
/* The libm assembly code uses this macro for RCSid strings.
|
||||
We don't put RCSid strings into object files. */
|
||||
#define RCSID(id) /* ignore them */
|
||||
@@ -149,7 +149,7 @@ do { \
|
||||
} while (0)
|
||||
|
||||
/* Get long double macros from a separate header. */
|
||||
//#include <math_ldbl.h>
|
||||
#include <math_ldbl.h>
|
||||
|
||||
/* ieee style elementary functions */
|
||||
extern double __ieee754_sqrt (double);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
SubDir HAIKU_TOP src system libroot posix math ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) glibc ] ;
|
||||
#SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) glibc ] ;
|
||||
#SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) glibc include ] ;
|
||||
#SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) glibc include arch $(TARGET_ARCH) ] ;
|
||||
SubDirCcFlags -Dnational ;
|
||||
|
||||
KernelMergeObject posix_math.o :
|
||||
@@ -8,20 +10,15 @@ KernelMergeObject posix_math.o :
|
||||
asincos.c
|
||||
asinh.c
|
||||
atan.c
|
||||
atan2.c
|
||||
atanh.c
|
||||
cabs.c
|
||||
cbrt.c
|
||||
ceilf.c
|
||||
cosh.c
|
||||
erf.c
|
||||
exp.c
|
||||
exp__E.c
|
||||
expm1.c
|
||||
floatmath.c
|
||||
floor.c
|
||||
floorf.c
|
||||
fmod.c
|
||||
gamma.c
|
||||
ieee.c
|
||||
j0.c
|
||||
|
||||
@@ -2,7 +2,6 @@ SubDir HAIKU_TOP src system libroot posix math arch x86 ;
|
||||
|
||||
KernelMergeObject posix_math_arch_$(TARGET_ARCH).o :
|
||||
cos.S
|
||||
fabs.S
|
||||
frexp.c
|
||||
isinf.c
|
||||
ldexp.c
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/i386/gen/fabs.S,v 1.5 1999/08/27 23:59:20 peter Exp $
|
||||
*/
|
||||
|
||||
#if defined(LIBC_RCS) && !defined(lint)
|
||||
.text
|
||||
.asciz "$FreeBSD: src/lib/libc/i386/gen/fabs.S,v 1.5 1999/08/27 23:59:20 peter Exp $"
|
||||
#endif /* LIBC_RCS and not lint */
|
||||
|
||||
|
||||
.global fabs
|
||||
.type fabs,@function
|
||||
fabs:
|
||||
fldl 4(%esp)
|
||||
fabs
|
||||
ret
|
||||
@@ -1,55 +0,0 @@
|
||||
/* s_ceilf.c -- float version of s_ceil.c.
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "math/math_private.h"
|
||||
|
||||
static const float sHuge = 1.0e30;
|
||||
|
||||
float
|
||||
ceilf(float x)
|
||||
{
|
||||
int32_t i0,j0;
|
||||
u_int32_t i;
|
||||
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
j0 = ((i0 >> 23) & 0xff) - 0x7f;
|
||||
if (j0 < 23) {
|
||||
if (j0 < 0) { /* raise inexact if x != 0 */
|
||||
if (sHuge + x > 0.0f) {/* return 0*sign(x) if |x|<1 */
|
||||
if (i0 < 0)
|
||||
i0 = 0x80000000;
|
||||
else if (i0 != 0)
|
||||
i0 = 0x3f800000;
|
||||
}
|
||||
} else {
|
||||
i = (0x007fffff) >> j0;
|
||||
if ((i0 & i) == 0)
|
||||
return x; /* x is integral */
|
||||
if (sHuge + x > 0.0f) { /* raise inexact flag */
|
||||
if (i0 > 0)
|
||||
i0 += (0x00800000) >> j0;
|
||||
i0 &= (~i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (j0 == 0x80)
|
||||
return x + x; /* inf or NaN */
|
||||
else
|
||||
return x; /* x is integral */
|
||||
}
|
||||
SET_FLOAT_WORD(x, i0);
|
||||
return x;
|
||||
}
|
||||
@@ -32,38 +32,12 @@ float logbf(float x) {return (float)logb((double)x);};
|
||||
float powf(float x, float y) {return (float)pow((double)x, (double)y);};
|
||||
float sqrtf(float x) {return (float)sqrt((double)x);};
|
||||
float hypotf(float x, float y) {return (float)hypot((double)x, (double)y);};
|
||||
float fabsf(float x) {return (float)fabs((double)x);};
|
||||
float fmodf(float x, float y) {return (float)fmod((double)x, (double)y);};
|
||||
float copysignf(float x, float y) {return (float)copysign((double)x, (double)y);};
|
||||
float erff(float x) {return (float)erf((double)x);};
|
||||
float erfcf(float x) {return (float)erfc((double)x);};
|
||||
float gammaf(float x) {return (float)gamma((double)x);};
|
||||
float lgammaf(float x) {return (float)lgamma((double)x);};
|
||||
float rintf(float x) {return (float)rint((double)x);};
|
||||
float scalbf(float x, float n) {return (float)scalb((double)x, (double)n);};
|
||||
|
||||
// TODO: use optimized versions of these
|
||||
double
|
||||
modf(double x, double *y)
|
||||
{
|
||||
// TODO: this truncates to int precision and is broken!
|
||||
// this should be implemented arch dependent!
|
||||
int integer = (int)x;
|
||||
*y = (double)integer;
|
||||
return x - integer;
|
||||
}
|
||||
|
||||
float
|
||||
modff(float x, float *y)
|
||||
{
|
||||
// TODO: this truncates to int precision and is broken!
|
||||
// this should be implemented arch dependent!
|
||||
double intpart = 0;
|
||||
float result = (float)modf((double)x, &intpart);
|
||||
*y = (float)intpart;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__signbitf(float value)
|
||||
@@ -93,33 +67,3 @@ __signbitl(long double value)
|
||||
return (u.i[2] & 0x8000) != 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__fpclassifyf(float value)
|
||||
{
|
||||
// TODO: implement me!
|
||||
return FP_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__fpclassify(double value)
|
||||
{
|
||||
// TODO: implement me!
|
||||
return FP_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__fpclassifyl(long double value)
|
||||
{
|
||||
// TODO: implement me!
|
||||
return FP_NORMAL;
|
||||
}
|
||||
|
||||
int
|
||||
finitef(float value)
|
||||
{
|
||||
int clazz = __fpclassifyf(value);
|
||||
return (clazz == FP_ZERO || clazz == FP_SUBNORMAL || clazz == FP_NORMAL);
|
||||
}
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <mathimpl.h>
|
||||
|
||||
vc(L, 4503599627370496.0E0 ,0000,5c00,0000,0000, 55, 1.0) /* 2**55 */
|
||||
|
||||
ic(L, 4503599627370496.0E0, 52, 1.0) /* 2**52 */
|
||||
|
||||
#ifdef vccast
|
||||
#define L vccast(L)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* floor(x) := the largest integer no larger than x;
|
||||
* ceil(x) := -floor(-x), for all real x.
|
||||
*
|
||||
* Note: Inexact will be signaled if x is not an integer, as is
|
||||
* customary for IEEE 754. No other signal can be emitted.
|
||||
*/
|
||||
double
|
||||
floor(x)
|
||||
double x;
|
||||
{
|
||||
volatile double y;
|
||||
|
||||
if (
|
||||
#if !defined(vax)&&!defined(tahoe)
|
||||
x != x || /* NaN */
|
||||
#endif /* !defined(vax)&&!defined(tahoe) */
|
||||
x >= L) /* already an even integer */
|
||||
return x;
|
||||
else if (x < (double)0)
|
||||
return -ceil(-x);
|
||||
else { /* now 0 <= x < L */
|
||||
y = L+x; /* destructive store must be forced */
|
||||
y -= L; /* an integer, and |x-y| < 1 */
|
||||
return x < y ? y-(double)1 : y;
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
ceil(x)
|
||||
double x;
|
||||
{
|
||||
volatile double y;
|
||||
|
||||
if (
|
||||
#if !defined(vax)&&!defined(tahoe)
|
||||
x != x || /* NaN */
|
||||
#endif /* !defined(vax)&&!defined(tahoe) */
|
||||
x >= L) /* already an even integer */
|
||||
return x;
|
||||
else if (x < (double)0)
|
||||
return -floor(-x);
|
||||
else { /* now 0 <= x < L */
|
||||
y = L+x; /* destructive store must be forced */
|
||||
y -= L; /* an integer, and |x-y| < 1 */
|
||||
return x > y ? y+(double)1 : y;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef ns32000 /* rint() is in ./NATIONAL/support.s */
|
||||
/*
|
||||
* algorithm for rint(x) in pseudo-pascal form ...
|
||||
*
|
||||
* real rint(x): real x;
|
||||
* ... delivers integer nearest x in direction of prevailing rounding
|
||||
* ... mode
|
||||
* const L = (last consecutive integer)/2
|
||||
* = 2**55; for VAX D
|
||||
* = 2**52; for IEEE 754 Double
|
||||
* real s,t;
|
||||
* begin
|
||||
* if x != x then return x; ... NaN
|
||||
* if |x| >= L then return x; ... already an integer
|
||||
* s := copysign(L,x);
|
||||
* t := x + s; ... = (x+s) rounded to integer
|
||||
* return t - s
|
||||
* end;
|
||||
*
|
||||
* Note: Inexact will be signaled if x is not an integer, as is
|
||||
* customary for IEEE 754. No other signal can be emitted.
|
||||
*/
|
||||
double
|
||||
rint(x)
|
||||
double x;
|
||||
{
|
||||
double s;
|
||||
volatile double t;
|
||||
const double one = 1.0;
|
||||
|
||||
#if !defined(vax)&&!defined(tahoe)
|
||||
if (x != x) /* NaN */
|
||||
return (x);
|
||||
#endif /* !defined(vax)&&!defined(tahoe) */
|
||||
if (copysign(x,one) >= L) /* already an integer */
|
||||
return (x);
|
||||
s = copysign(L,x);
|
||||
t = x + s; /* x+s rounded to integer */
|
||||
return (t - s);
|
||||
}
|
||||
#endif /* not national */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* s_floorf.c -- float version of s_floor.c.
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* floorf(x)
|
||||
* Return x rounded toward -inf to integral value
|
||||
* Method:
|
||||
* Bit twiddling.
|
||||
* Exception:
|
||||
* Inexact flag raised if x not equal to floorf(x).
|
||||
*/
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <math.h>
|
||||
#include "math/math_private.h"
|
||||
|
||||
static const float sHuge = 1.0e30;
|
||||
|
||||
float
|
||||
floorf(float x)
|
||||
{
|
||||
int32 i0,j0;
|
||||
uint32 i;
|
||||
|
||||
GET_FLOAT_WORD(i0, x);
|
||||
j0 = ((i0 >> 23) & 0xff) - 0x7f;
|
||||
if (j0 < 23) {
|
||||
if (j0 < 0) { /* raise inexact if x != 0 */
|
||||
if (sHuge + x > 0.0f) {/* return 0*sign(x) if |x|<1 */
|
||||
if (i0 >= 0)
|
||||
i0 = 0;
|
||||
else if ((i0 & 0x7fffffff) != 0)
|
||||
i0 = 0xbf800000;
|
||||
}
|
||||
} else {
|
||||
i = (0x007fffff) >> j0;
|
||||
if ((i0 & i) == 0)
|
||||
return x; /* x is integral */
|
||||
if (sHuge + x > 0.0f) { /* raise inexact flag */
|
||||
if (i0 < 0)
|
||||
i0 += (0x00800000) >> j0;
|
||||
i0 &= (~i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (j0 == 0x80)
|
||||
return x + x; /* inf or NaN */
|
||||
else
|
||||
return x; /* x is integral */
|
||||
}
|
||||
SET_FLOAT_WORD(x, i0);
|
||||
return x;
|
||||
}
|
||||
@@ -82,6 +82,7 @@
|
||||
static const double novf=1.7E308, nunf=3.0E-308,zero=0.0;
|
||||
#endif /* defined(vax)||defined(tahoe) */
|
||||
|
||||
|
||||
double
|
||||
scalb(double x, double N)
|
||||
{
|
||||
@@ -128,6 +129,7 @@ scalb(double x, double N)
|
||||
return(x);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
double
|
||||
copysign(double x, double y)
|
||||
@@ -190,6 +192,7 @@ finite(double x)
|
||||
#endif /* national */
|
||||
#endif /* defined(vax)||defined(tahoe) */
|
||||
}
|
||||
#endif
|
||||
|
||||
double
|
||||
drem(double x, double p)
|
||||
|
||||
Reference in New Issue
Block a user