newlib: Add non LDBL_EQ_DBL math support for aarch64, i386, and x86_64
Rename s_nearbyint.c, s_fdim.c and s_scalbln.c to remove conflicts Remove functions that are not needed from above files Modify include paths Add includes missing in cygwin build Add missing types Create Makefiles Create header files to resolve dependencies between directories Modify some instances of unsigned long to uint64_t for 32 bit platforms Add HAVE_FPMATH_H
This commit is contained in:
parent
c630a6a837
commit
048ebea981
|
@ -62,4 +62,7 @@ m4_foreach_w([MACHINE], [
|
||||||
z8k
|
z8k
|
||||||
], [AM_CONDITIONAL([HAVE_LIBC_MACHINE_]m4_toupper(MACHINE), test "${machine_dir}" = MACHINE)])
|
], [AM_CONDITIONAL([HAVE_LIBC_MACHINE_]m4_toupper(MACHINE), test "${machine_dir}" = MACHINE)])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(HAVE_FPMATH_H, test -r "${srcdir}/libc/machine/${machine_dir}/machine/_fpmath.h")
|
||||||
|
|
||||||
|
|
||||||
AM_CONDITIONAL(MACH_ADD_SETJMP, test "x$mach_add_setjmp" = "xtrue")
|
AM_CONDITIONAL(MACH_ADD_SETJMP, test "x$mach_add_setjmp" = "xtrue")
|
||||||
|
|
|
@ -445,7 +445,8 @@ extern float hypotf (float, float);
|
||||||
simply call the double functions. On Cygwin the long double functions
|
simply call the double functions. On Cygwin the long double functions
|
||||||
are implemented independently from newlib to be able to use optimized
|
are implemented independently from newlib to be able to use optimized
|
||||||
assembler functions despite using the Microsoft x86_64 ABI. */
|
assembler functions despite using the Microsoft x86_64 ABI. */
|
||||||
#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
|
#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__) || \
|
||||||
|
defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
|
||||||
/* Reentrant ANSI C functions. */
|
/* Reentrant ANSI C functions. */
|
||||||
#ifndef __math_68881
|
#ifndef __math_68881
|
||||||
extern long double atanl (long double);
|
extern long double atanl (long double);
|
||||||
|
|
|
@ -27,19 +27,25 @@
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Change unsigned int/long used by FreeBSD to fixed width types because
|
||||||
|
* ilp32 has a different size for unsigned long. --joel (20 Aug 2022)
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
union IEEEl2bits {
|
union IEEEl2bits {
|
||||||
long double e;
|
long double e;
|
||||||
struct {
|
struct {
|
||||||
unsigned long manl :64;
|
uint64_t manl :64;
|
||||||
unsigned long manh :48;
|
uint64_t manh :48;
|
||||||
unsigned int exp :15;
|
uint32_t exp :15;
|
||||||
unsigned int sign :1;
|
uint32_t sign :1;
|
||||||
} bits;
|
} bits;
|
||||||
/* TODO andrew: Check the packing here */
|
/* TODO andrew: Check the packing here */
|
||||||
struct {
|
struct {
|
||||||
unsigned long manl :64;
|
uint64_t manl :64;
|
||||||
unsigned long manh :48;
|
uint64_t manh :48;
|
||||||
unsigned int expsign :16;
|
uint32_t expsign :16;
|
||||||
} xbits;
|
} xbits;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,18 @@ else
|
||||||
include %D%/math/Makefile.inc
|
include %D%/math/Makefile.inc
|
||||||
endif
|
endif
|
||||||
include %D%/common/Makefile.inc
|
include %D%/common/Makefile.inc
|
||||||
|
|
||||||
|
if HAVE_FPMATH_H
|
||||||
|
include %D%/ld/Makefile.inc
|
||||||
|
endif # HAVE_FPMATH_H
|
||||||
|
|
||||||
include %D%/complex/Makefile.inc
|
include %D%/complex/Makefile.inc
|
||||||
include %D%/fenv/Makefile.inc
|
include %D%/fenv/Makefile.inc
|
||||||
include %D%/test/Makefile.inc
|
include %D%/test/Makefile.inc
|
||||||
|
|
||||||
if HAVE_LIBM_MACHINE_AARCH64
|
if HAVE_LIBM_MACHINE_AARCH64
|
||||||
include %D%/machine/aarch64/Makefile.inc
|
include %D%/machine/aarch64/Makefile.inc
|
||||||
|
include %D%/ld128/Makefile.inc
|
||||||
endif
|
endif
|
||||||
if HAVE_LIBM_MACHINE_AMDGCN
|
if HAVE_LIBM_MACHINE_AMDGCN
|
||||||
include %D%/machine/amdgcn/Makefile.inc
|
include %D%/machine/amdgcn/Makefile.inc
|
||||||
|
@ -59,6 +65,7 @@ include %D%/machine/arm/Makefile.inc
|
||||||
endif
|
endif
|
||||||
if HAVE_LIBM_MACHINE_I386
|
if HAVE_LIBM_MACHINE_I386
|
||||||
include %D%/machine/i386/Makefile.inc
|
include %D%/machine/i386/Makefile.inc
|
||||||
|
include %D%/ld80/Makefile.inc
|
||||||
endif
|
endif
|
||||||
if HAVE_LIBM_MACHINE_MIPS
|
if HAVE_LIBM_MACHINE_MIPS
|
||||||
include %D%/machine/mips/Makefile.inc
|
include %D%/machine/mips/Makefile.inc
|
||||||
|
@ -83,6 +90,7 @@ include %D%/machine/riscv/Makefile.inc
|
||||||
endif
|
endif
|
||||||
if HAVE_LIBM_MACHINE_X86_64
|
if HAVE_LIBM_MACHINE_X86_64
|
||||||
include %D%/machine/x86_64/Makefile.inc
|
include %D%/machine/x86_64/Makefile.inc
|
||||||
|
include %D%/ld80/Makefile.inc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
%C%_lsrc = \
|
||||||
|
%D%/e_acoshl.c \
|
||||||
|
%D%/e_acosl.c \
|
||||||
|
%D%/e_asinl.c \
|
||||||
|
%D%/e_atan2l.c \
|
||||||
|
%D%/e_atanhl.c \
|
||||||
|
%D%/e_coshl.c \
|
||||||
|
%D%/e_fmodl.c \
|
||||||
|
%D%/e_lgammal.c \
|
||||||
|
%D%/e_remainderl.c \
|
||||||
|
%D%/e_sinhl.c \
|
||||||
|
%D%/s_asinhl.c \
|
||||||
|
%D%/s_atanl.c \
|
||||||
|
%D%/s_cbrtl.c \
|
||||||
|
%D%/s_ceill.c \
|
||||||
|
%D%/s_copysignl.c \
|
||||||
|
%D%/s_cosl.c \
|
||||||
|
%D%/s_fabsl.c \
|
||||||
|
%D%/fdiml.c \
|
||||||
|
%D%/s_floorl.c \
|
||||||
|
%D%/s_fmal.c \
|
||||||
|
%D%/s_fmaxl.c \
|
||||||
|
%D%/s_fminl.c \
|
||||||
|
%D%/s_frexpl.c \
|
||||||
|
%D%/s_ilogbl.c \
|
||||||
|
%D%/s_llrintl.c \
|
||||||
|
%D%/s_llroundl.c \
|
||||||
|
%D%/s_logbl.c \
|
||||||
|
%D%/s_lrint.c \
|
||||||
|
%D%/s_lrintl.c \
|
||||||
|
%D%/s_lround.c \
|
||||||
|
%D%/s_lroundl.c \
|
||||||
|
%D%/s_modfl.c \
|
||||||
|
%D%/s_nearbyintl.c \
|
||||||
|
%D%/s_nextafterl.c \
|
||||||
|
%D%/s_nexttoward.c \
|
||||||
|
%D%/s_nexttowardf.c \
|
||||||
|
%D%/s_remquol.c \
|
||||||
|
%D%/s_rintl.c \
|
||||||
|
%D%/s_roundl.c \
|
||||||
|
%D%/scalblnl.c \
|
||||||
|
%D%/s_scalbnl.c \
|
||||||
|
%D%/s_sinl.c \
|
||||||
|
%D%/s_tanhl.c \
|
||||||
|
%D%/s_tanl.c \
|
||||||
|
%D%/s_truncl.c
|
||||||
|
|
||||||
|
libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
|
||||||
|
|
||||||
|
if HAVE_LONG_DOUBLE
|
||||||
|
libm_a_SOURCES += $(%C%_lsrc)
|
||||||
|
endif # HAVE_LONG_DOUBLE
|
||||||
|
|
||||||
|
LIBM_CHEWOUT_FILES +=
|
||||||
|
|
||||||
|
LIBM_CHAPTERS +=
|
|
@ -16,6 +16,8 @@ __FBSDID("$FreeBSD$");
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "math_private.h"
|
||||||
|
|
||||||
|
long double lgammal_r(long double x, int *signp);
|
||||||
|
|
||||||
extern int signgam;
|
extern int signgam;
|
||||||
|
|
||||||
long double
|
long double
|
||||||
|
|
|
@ -43,6 +43,13 @@ fn(type x, type y) \
|
||||||
return (x > y ? x - y : 0.0); \
|
return (x > y ? x - y : 0.0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* fdim and fdimf are defined elsewhere in
|
||||||
|
* newlib. Ignore the freebsd versions and only compile
|
||||||
|
* fdiml.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
DECL(double, fdim)
|
DECL(double, fdim)
|
||||||
DECL(float, fdimf)
|
DECL(float, fdimf)
|
||||||
|
#endif
|
||||||
DECL(long double, fdiml)
|
DECL(long double, fdiml)
|
|
@ -33,7 +33,7 @@
|
||||||
#define _FPMATH_H_
|
#define _FPMATH_H_
|
||||||
|
|
||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
#include "_fpmath.h"
|
#include "machine/_fpmath.h" /* changed to machine for newlib */
|
||||||
|
|
||||||
#ifndef _IEEE_WORD_ORDER
|
#ifndef _IEEE_WORD_ORDER
|
||||||
#define _IEEE_WORD_ORDER _BYTE_ORDER
|
#define _IEEE_WORD_ORDER _BYTE_ORDER
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-1999.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if LDBL_MANT_DIG == 64
|
||||||
|
#include "../ld80/invtrig.h"
|
||||||
|
#elif LDBL_MANT_DIG == 113
|
||||||
|
#include "../ld128/invtrig.h"
|
||||||
|
#else
|
||||||
|
#error "Unsupported long double format"
|
||||||
|
#endif
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-1999.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if LDBL_MANT_DIG == 64
|
||||||
|
#include "../ld80/k_expl.h"
|
||||||
|
#elif LDBL_MANT_DIG == 113
|
||||||
|
#include "../ld128/k_expl.h"
|
||||||
|
#else
|
||||||
|
#error "Unsupported long double format"
|
||||||
|
#endif
|
|
@ -20,6 +20,23 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <machine/endian.h>
|
#include <machine/endian.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* __double_t and __float_t are defined elsewhere in
|
||||||
|
* freebsd and used to define double_t and float_t.
|
||||||
|
* Newlib has already went through the process of
|
||||||
|
* defining double_t and float_t so we should be able
|
||||||
|
* to use them to define __double_t and __float_t for
|
||||||
|
* this file.
|
||||||
|
*/
|
||||||
|
typedef double_t __double_t;
|
||||||
|
typedef float_t __float_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Necessary to disable Protection Enabled specific
|
||||||
|
* Free-bsd source.
|
||||||
|
*/
|
||||||
|
#define NO_FPSETPREC
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The original fdlibm code used statements like:
|
* The original fdlibm code used statements like:
|
||||||
* n0 = ((*(int*)&one)>>29)^1; * index of high word *
|
* n0 = ((*(int*)&one)>>29)^1; * index of high word *
|
||||||
|
@ -644,7 +661,7 @@ rnintl(long double x)
|
||||||
* return type provided their arg is a floating point integer. They can
|
* return type provided their arg is a floating point integer. They can
|
||||||
* sometimes be more efficient because no rounding is required.
|
* sometimes be more efficient because no rounding is required.
|
||||||
*/
|
*/
|
||||||
#if defined(amd64) || defined(__i386__)
|
#if defined(amd64) || (defined(__i386__) && (!defined _SOFT_FLOAT))
|
||||||
#define irint(x) \
|
#define irint(x) \
|
||||||
(sizeof(x) == sizeof(float) && \
|
(sizeof(x) == sizeof(float) && \
|
||||||
sizeof(__float_t) == sizeof(long double) ? irintf(x) : \
|
sizeof(__float_t) == sizeof(long double) ? irintf(x) : \
|
||||||
|
@ -677,7 +694,7 @@ irintd(double x)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__amd64__) || defined(__i386__)
|
#if defined(__amd64__) || (defined(__i386__) && (!defined _SOFT_FLOAT))
|
||||||
static __inline int
|
static __inline int
|
||||||
irintl(long double x)
|
irintl(long double x)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "fpmath.h"
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ int
|
||||||
ilogbl(long double x)
|
ilogbl(long double x)
|
||||||
{
|
{
|
||||||
union IEEEl2bits u;
|
union IEEEl2bits u;
|
||||||
unsigned long m;
|
uint64_t m;
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
u.e = x;
|
u.e = x;
|
||||||
|
@ -32,11 +33,11 @@ ilogbl(long double x)
|
||||||
return (FP_ILOGB0);
|
return (FP_ILOGB0);
|
||||||
/* denormalized */
|
/* denormalized */
|
||||||
if (u.bits.manh == 0) {
|
if (u.bits.manh == 0) {
|
||||||
m = 1lu << (LDBL_MANL_SIZE - 1);
|
m = 1llu << (LDBL_MANL_SIZE - 1);
|
||||||
for (b = LDBL_MANH_SIZE; !(u.bits.manl & m); m >>= 1)
|
for (b = LDBL_MANH_SIZE; !(u.bits.manl & m); m >>= 1)
|
||||||
b++;
|
b++;
|
||||||
} else {
|
} else {
|
||||||
m = 1lu << (LDBL_MANH_SIZE - 1);
|
m = 1llu << (LDBL_MANH_SIZE - 1);
|
||||||
for (b = 0; !(u.bits.manh & m); m >>= 1)
|
for (b = 0; !(u.bits.manh & m); m >>= 1)
|
||||||
b++;
|
b++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "fpmath.h"
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ long double
|
||||||
logbl(long double x)
|
logbl(long double x)
|
||||||
{
|
{
|
||||||
union IEEEl2bits u;
|
union IEEEl2bits u;
|
||||||
unsigned long m;
|
uint64_t m;
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
u.e = x;
|
u.e = x;
|
||||||
|
@ -34,11 +35,11 @@ logbl(long double x)
|
||||||
}
|
}
|
||||||
/* denormalized */
|
/* denormalized */
|
||||||
if (u.bits.manh == 0) {
|
if (u.bits.manh == 0) {
|
||||||
m = 1lu << (LDBL_MANL_SIZE - 1);
|
m = 1llu << (LDBL_MANL_SIZE - 1);
|
||||||
for (b = LDBL_MANH_SIZE; !(u.bits.manl & m); m >>= 1)
|
for (b = LDBL_MANH_SIZE; !(u.bits.manl & m); m >>= 1)
|
||||||
b++;
|
b++;
|
||||||
} else {
|
} else {
|
||||||
m = 1lu << (LDBL_MANH_SIZE - 1);
|
m = 1llu << (LDBL_MANH_SIZE - 1);
|
||||||
for (b = 0; !(u.bits.manh & m); m >>= 1)
|
for (b = 0; !(u.bits.manh & m); m >>= 1)
|
||||||
b++;
|
b++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/limits.h>
|
#include <limits.h>
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,13 @@ fn(type x) \
|
||||||
return (ret); \
|
return (ret); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nearbyint and nearbyintf are defined elsewhere in
|
||||||
|
* newlib. Ignore the freebsd versions and only compile
|
||||||
|
* nearbyintl.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
DECL(double, nearbyint, rint)
|
DECL(double, nearbyint, rint)
|
||||||
DECL(float, nearbyintf, rintf)
|
DECL(float, nearbyintf, rintf)
|
||||||
|
#endif
|
||||||
DECL(long double, nearbyintl, rintl)
|
DECL(long double, nearbyintl, rintl)
|
|
@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "fpmath.h"
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,12 @@ __FBSDID("$FreeBSD$");
|
||||||
#define NMAX 65536
|
#define NMAX 65536
|
||||||
#define NMIN -65536
|
#define NMIN -65536
|
||||||
|
|
||||||
|
/*
|
||||||
|
* scalbln and scalblnf are defined elsewhere in
|
||||||
|
* newlib. Ignore the freebsd versions and only compile
|
||||||
|
* scalblnl.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
double
|
double
|
||||||
scalbln(double x, long n)
|
scalbln(double x, long n)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +53,7 @@ scalblnf(float x, long n)
|
||||||
|
|
||||||
return (scalbnf(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n));
|
return (scalbnf(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
long double
|
long double
|
||||||
scalblnl(long double x, long n)
|
scalblnl(long double x, long n)
|
|
@ -0,0 +1,14 @@
|
||||||
|
%C%_lsrc = \
|
||||||
|
%D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c %D%/s_expl.c \
|
||||||
|
%D%/s_logl.c %D%/b_tgammal.c %D%/invtrig.c \
|
||||||
|
%D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
|
||||||
|
|
||||||
|
libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
|
||||||
|
|
||||||
|
if HAVE_LONG_DOUBLE
|
||||||
|
libm_a_SOURCES += $(%C%_lsrc)
|
||||||
|
endif # HAVE_LONG_DOUBLE
|
||||||
|
|
||||||
|
LIBM_CHEWOUT_FILES +=
|
||||||
|
|
||||||
|
LIBM_CHAPTERS +=
|
|
@ -19,9 +19,9 @@ __FBSDID("$FreeBSD$");
|
||||||
* Converted to long double by Steven G. Kargl.
|
* Converted to long double by Steven G. Kargl.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const volatile double vzero = 0;
|
static const volatile double vzero = 0;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const long double bp[] = {
|
static const long double bp[] = {
|
||||||
1.0L,
|
1.0L,
|
||||||
|
|
|
@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
#include "../ld/fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
|
|
||||||
#define BIAS (LDBL_MAX_EXP - 1)
|
#define BIAS (LDBL_MAX_EXP - 1)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
|
|
||||||
#define BIAS (LDBL_MAX_EXP - 1)
|
#define BIAS (LDBL_MAX_EXP - 1)
|
||||||
#define MANH_SIZE (LDBL_MANH_SIZE + 1)
|
#define MANH_SIZE (LDBL_MANH_SIZE + 1)
|
||||||
|
|
|
@ -17,8 +17,8 @@ __FBSDID("$FreeBSD$");
|
||||||
/*
|
/*
|
||||||
* ld128 version of k_cos.c. See ../src/k_cos.c for most comments.
|
* ld128 version of k_cos.c. See ../src/k_cos.c for most comments.
|
||||||
*/
|
*/
|
||||||
|
#include <math.h>
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Domain [-0.7854, 0.7854], range ~[-1.17e-39, 1.19e-39]:
|
* Domain [-0.7854, 0.7854], range ~[-1.17e-39, 1.19e-39]:
|
||||||
|
|
|
@ -17,8 +17,8 @@ __FBSDID("$FreeBSD$");
|
||||||
/*
|
/*
|
||||||
* ld128 version of k_sin.c. See ../src/k_sin.c for most comments.
|
* ld128 version of k_sin.c. See ../src/k_sin.c for most comments.
|
||||||
*/
|
*/
|
||||||
|
#include <math.h>
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const double
|
static const double
|
||||||
half = 0.5;
|
half = 0.5;
|
||||||
|
|
|
@ -20,9 +20,9 @@ __FBSDID("$FreeBSD$");
|
||||||
*/
|
*/
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
/* XXX Prevent compilers from erroneously constant folding these: */
|
/* XXX Prevent compilers from erroneously constant folding these: */
|
||||||
static const volatile long double tiny = 0x1p-10000L;
|
static const volatile long double tiny = 0x1p-10000L;
|
||||||
|
|
|
@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#define TBLBITS 7
|
#define TBLBITS 7
|
||||||
|
|
|
@ -37,9 +37,9 @@ __FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
#include "k_expl.h"
|
#include "k_expl.h"
|
||||||
|
|
||||||
/* XXX Prevent compilers from erroneously constant folding these: */
|
/* XXX Prevent compilers from erroneously constant folding these: */
|
||||||
|
|
|
@ -81,12 +81,12 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#ifndef NO_STRUCT_RETURN
|
#ifndef NO_STRUCT_RETURN
|
||||||
#define STRUCT_RETURN
|
#define STRUCT_RETURN
|
||||||
#endif
|
#endif
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
#if !defined(NO_UTAB) && !defined(NO_UTABL)
|
#if !defined(NO_UTAB) && !defined(NO_UTABL)
|
||||||
#define USE_UTAB
|
#define USE_UTAB
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
%C%_lsrc = \
|
||||||
|
%D%/b_tgammal.c %D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c \
|
||||||
|
%D%/s_expl.c %D%/s_logl.c %D%/s_sinpil.c %D%/s_cospil.c \
|
||||||
|
%D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
|
||||||
|
|
||||||
|
|
||||||
|
libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
|
||||||
|
|
||||||
|
if HAVE_LONG_DOUBLE
|
||||||
|
libm_a_SOURCES += $(%C%_lsrc)
|
||||||
|
endif # HAVE_LONG_DOUBLE
|
||||||
|
|
||||||
|
LIBM_CHEWOUT_FILES +=
|
||||||
|
|
||||||
|
LIBM_CHAPTERS +=
|
|
@ -35,8 +35,8 @@
|
||||||
* bsdrc/b_exp.c converted to long double by Steven G. Kargl.
|
* bsdrc/b_exp.c converted to long double by Steven G. Kargl.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const union IEEEl2bits
|
static const union IEEEl2bits
|
||||||
p0u = LD80C(0xaaaaaaaaaaaaaaab, -3, 1.66666666666666666671e-01L),
|
p0u = LD80C(0xaaaaaaaaaaaaaaab, -3, 1.66666666666666666671e-01L),
|
||||||
|
|
|
@ -55,9 +55,12 @@
|
||||||
#include <ieeefp.h>
|
#include <ieeefp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
|
long double sinpil(long double x);
|
||||||
|
long double cospil(long double x);
|
||||||
|
|
||||||
/* Used in b_log.c and below. */
|
/* Used in b_log.c and below. */
|
||||||
struct Double {
|
struct Double {
|
||||||
|
|
|
@ -23,9 +23,9 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <ieeefp.h>
|
#include <ieeefp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const volatile double vzero = 0;
|
static const volatile double vzero = 0;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ __FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Polynomial evaluator:
|
* Polynomial evaluator:
|
||||||
|
@ -122,7 +122,7 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
/* Table size */
|
/* Table size */
|
||||||
#define NXT 32
|
#define NXT 32
|
||||||
|
|
|
@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
#include "../ld/fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
|
|
||||||
#define BIAS (LDBL_MAX_EXP - 1)
|
#define BIAS (LDBL_MAX_EXP - 1)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
|
|
||||||
#define BIAS (LDBL_MAX_EXP - 1)
|
#define BIAS (LDBL_MAX_EXP - 1)
|
||||||
#define MANH_SIZE LDBL_MANH_SIZE
|
#define MANH_SIZE LDBL_MANH_SIZE
|
||||||
|
|
|
@ -17,8 +17,8 @@ __FBSDID("$FreeBSD$");
|
||||||
/*
|
/*
|
||||||
* ld80 version of k_cos.c. See ../src/k_cos.c for most comments.
|
* ld80 version of k_cos.c. See ../src/k_cos.c for most comments.
|
||||||
*/
|
*/
|
||||||
|
#include <math.h>
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Domain [-0.7854, 0.7854], range ~[-2.43e-23, 2.425e-23]:
|
* Domain [-0.7854, 0.7854], range ~[-2.43e-23, 2.425e-23]:
|
||||||
|
|
|
@ -17,8 +17,8 @@ __FBSDID("$FreeBSD$");
|
||||||
/*
|
/*
|
||||||
* ld80 version of k_sin.c. See ../src/k_sin.c for most comments.
|
* ld80 version of k_sin.c. See ../src/k_sin.c for most comments.
|
||||||
*/
|
*/
|
||||||
|
#include <math.h>
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const double
|
static const double
|
||||||
half = 0.5;
|
half = 0.5;
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const double
|
static const double
|
||||||
pi_hi = 3.1415926814079285e+00, /* 0x400921fb 0x58000000 */
|
pi_hi = 3.1415926814079285e+00, /* 0x400921fb 0x58000000 */
|
||||||
|
|
|
@ -23,9 +23,9 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <ieeefp.h>
|
#include <ieeefp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
/* XXX Prevent compilers from erroneously constant folding: */
|
/* XXX Prevent compilers from erroneously constant folding: */
|
||||||
static const volatile long double tiny = 0x1p-10000L;
|
static const volatile long double tiny = 0x1p-10000L;
|
||||||
|
|
|
@ -36,9 +36,9 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <ieeefp.h>
|
#include <ieeefp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
#define TBLBITS 7
|
#define TBLBITS 7
|
||||||
#define TBLSIZE (1 << TBLBITS)
|
#define TBLSIZE (1 << TBLBITS)
|
||||||
|
|
|
@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <ieeefp.h>
|
#include <ieeefp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
#include "k_expl.h"
|
#include "k_expl.h"
|
||||||
|
|
||||||
/* XXX Prevent compilers from erroneously constant folding these: */
|
/* XXX Prevent compilers from erroneously constant folding these: */
|
||||||
|
|
|
@ -85,13 +85,13 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <ieeefp.h>
|
#include <ieeefp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#define i386_SSE_GOOD
|
#define i386_SSE_GOOD
|
||||||
#ifndef NO_STRUCT_RETURN
|
#ifndef NO_STRUCT_RETURN
|
||||||
#define STRUCT_RETURN
|
#define STRUCT_RETURN
|
||||||
#endif
|
#endif
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
#if !defined(NO_UTAB) && !defined(NO_UTABL)
|
#if !defined(NO_UTAB) && !defined(NO_UTABL)
|
||||||
#define USE_UTAB
|
#define USE_UTAB
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "fpmath.h"
|
#include "../ld/fpmath.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "math_private.h"
|
#include "../ld/math_private.h"
|
||||||
|
|
||||||
static const union IEEEl2bits
|
static const union IEEEl2bits
|
||||||
pi_hi_u = LD80C(0xc90fdaa200000000, 1, 3.14159265346825122833e+00L),
|
pi_hi_u = LD80C(0xc90fdaa200000000, 1, 3.14159265346825122833e+00L),
|
||||||
|
|
Loading…
Reference in New Issue