mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2024-12-28 20:43:41 +01:00
Get much of src/ to build.
Use build.clang.sh or build.gcc.sh for the time being.
This commit is contained in:
parent
b0b27a0ff4
commit
3c7b5cc6f7
46 changed files with 71 additions and 57 deletions
1
src/build.clang.sh
Executable file
1
src/build.clang.sh
Executable file
|
@ -0,0 +1 @@
|
|||
for i in *.c; do clang -D__BSD_VISIBLE -c -O0 -I. -I../include -I../ld128 $i; done 2>err
|
1
src/build.gcc.sh
Executable file
1
src/build.gcc.sh
Executable file
|
@ -0,0 +1 @@
|
|||
for i in *.c; do gcc -D__BSD_VISIBLE -c -O0 -I. -I../include -I../ld128 $i; done 2>err
|
|
@ -16,7 +16,7 @@
|
|||
#include <float.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
@ -25,13 +25,13 @@
|
|||
#if LDBL_MANL_SIZE > 32
|
||||
typedef uint64_t manl_t;
|
||||
#else
|
||||
typedef uint32_t manl_t;
|
||||
typedef u_int32_t manl_t;
|
||||
#endif
|
||||
|
||||
#if LDBL_MANH_SIZE > 32
|
||||
typedef uint64_t manh_t;
|
||||
#else
|
||||
typedef uint32_t manh_t;
|
||||
typedef u_int32_t manh_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <float.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if LDBL_MANL_SIZE > 32
|
||||
typedef uint64_t man_t;
|
||||
#else
|
||||
typedef uint32_t man_t;
|
||||
typedef u_int32_t man_t;
|
||||
#endif
|
||||
|
||||
long double
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
#include "math_private.h"
|
||||
#include "k_logf.h"
|
||||
|
||||
// VBS
|
||||
#define float_t float
|
||||
|
||||
static const float
|
||||
two25 = 3.3554432000e+07, /* 0x4c000000 */
|
||||
ivln10hi = 4.3432617188e-01, /* 0x3ede6000 */
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
#include "math_private.h"
|
||||
#include "k_logf.h"
|
||||
|
||||
// VBS
|
||||
#define float_t float
|
||||
|
||||
static const float
|
||||
two25 = 3.3554432000e+07, /* 0x4c000000 */
|
||||
ivln2hi = 1.4428710938e+00, /* 0x3fb8b000 */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
|
||||
/* Return (x + ulp) for normal positive x. Assumes no overflow. */
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const uint32_t k = 1799; /* constant for reduction */
|
||||
static const u_int32_t k = 1799; /* constant for reduction */
|
||||
static const double kln2 = 1246.97177782734161156; /* k * ln2 */
|
||||
|
||||
/*
|
||||
|
@ -46,7 +46,7 @@ static double
|
|||
__frexp_exp(double x, int *expt)
|
||||
{
|
||||
double exp_x;
|
||||
uint32_t hx;
|
||||
u_int32_t hx;
|
||||
|
||||
/*
|
||||
* We use exp(x) = exp(x - kln2) * 2**k, carefully chosen to
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const uint32_t k = 235; /* constant for reduction */
|
||||
static const u_int32_t k = 235; /* constant for reduction */
|
||||
static const float kln2 = 162.88958740F; /* k * ln2 */
|
||||
|
||||
/*
|
||||
|
@ -45,7 +45,7 @@ static float
|
|||
__frexp_expf(float x, int *expt)
|
||||
{
|
||||
double exp_x;
|
||||
uint32_t hx;
|
||||
u_int32_t hx;
|
||||
|
||||
exp_x = expf(x - kln2);
|
||||
GET_FLOAT_WORD(hx, exp_x);
|
||||
|
|
|
@ -230,7 +230,7 @@ do { \
|
|||
/*
|
||||
* Common routine to process the arguments to nan(), nanf(), and nanl().
|
||||
*/
|
||||
void _scan_nan(uint32_t *__words, int __num_words, const char *__s);
|
||||
void _scan_nan(u_int32_t *__words, int __num_words, const char *__s);
|
||||
|
||||
#ifdef _COMPLEX_H
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ extern const union __nan_un {
|
|||
float __uf;
|
||||
} __nan;
|
||||
|
||||
/* VBS
|
||||
#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
|
||||
#define __MATH_BUILTIN_CONSTANTS
|
||||
#endif
|
||||
|
@ -41,6 +42,10 @@ extern const union __nan_un {
|
|||
#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
|
||||
#define __MATH_BUILTIN_RELOPS
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define __MATH_BUILTIN_CONSTANTS
|
||||
#define __MATH_BUILTIN_RELOPS
|
||||
|
||||
#ifdef __MATH_BUILTIN_CONSTANTS
|
||||
#define HUGE_VAL __builtin_huge_val()
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
//__FBSDID("$FreeBSD: src/lib/msun/src/s_cbrtl.c,v 1.1 2011/03/12 19:37:35 kargl Exp $");
|
||||
|
||||
#include <float.h>
|
||||
#include <ieeefp.h>
|
||||
// VBS
|
||||
//#include <ieeefp.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
@ -36,7 +37,7 @@ cbrtl(long double x)
|
|||
long double r, s, t, w;
|
||||
double dr, dt, dx;
|
||||
float ft, fx;
|
||||
uint32_t hx;
|
||||
u_int32_t hx;
|
||||
uint16_t expsign;
|
||||
int k;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <openlibm.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
#ifdef LDBL_IMPLICIT_NBIT
|
||||
#define MANH_SIZE (LDBL_MANH_SIZE + 1)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "math_private.h"
|
||||
|
||||
static const uint32_t
|
||||
static const u_int32_t
|
||||
exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */
|
||||
cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */
|
||||
|
||||
|
@ -40,7 +40,7 @@ double complex
|
|||
cexp(double complex z)
|
||||
{
|
||||
double x, y, exp_x;
|
||||
uint32_t hx, hy, lx, ly;
|
||||
u_int32_t hx, hy, lx, ly;
|
||||
|
||||
x = creal(z);
|
||||
y = cimag(z);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "math_private.h"
|
||||
|
||||
static const uint32_t
|
||||
static const u_int32_t
|
||||
exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */
|
||||
cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */
|
||||
|
||||
|
@ -40,7 +40,7 @@ float complex
|
|||
cexpf(float complex z)
|
||||
{
|
||||
float x, y, exp_x;
|
||||
uint32_t hx, hy;
|
||||
u_int32_t hx, hy;
|
||||
|
||||
x = crealf(z);
|
||||
y = cimagf(z);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
long double
|
||||
copysignl(long double x, long double y)
|
||||
|
|
|
@ -76,7 +76,7 @@ ctanh(double complex z)
|
|||
{
|
||||
double x, y;
|
||||
double t, beta, s, rho, denom;
|
||||
uint32_t hx, ix, lx;
|
||||
u_int32_t hx, ix, lx;
|
||||
|
||||
x = creal(z);
|
||||
y = cimag(z);
|
||||
|
|
|
@ -41,7 +41,7 @@ ctanhf(float complex z)
|
|||
{
|
||||
float x, y;
|
||||
float t, beta, s, rho, denom;
|
||||
uint32_t hx, ix;
|
||||
u_int32_t hx, ix;
|
||||
|
||||
x = crealf(z);
|
||||
y = cimagf(z);
|
||||
|
|
|
@ -341,7 +341,7 @@ double
|
|||
exp2(double x)
|
||||
{
|
||||
double r, t, twopk, twopkp1000, z;
|
||||
uint32_t hx, ix, lx, i0;
|
||||
u_int32_t hx, ix, lx, i0;
|
||||
int k;
|
||||
|
||||
/* Filter out exceptional cases. */
|
||||
|
|
|
@ -95,7 +95,7 @@ exp2f(float x)
|
|||
{
|
||||
double tv, twopk, u, z;
|
||||
float t;
|
||||
uint32_t hx, ix, i0;
|
||||
u_int32_t hx, ix, i0;
|
||||
int32_t k;
|
||||
|
||||
/* Filter out exceptional cases. */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
long double
|
||||
fabsl(long double x)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <openlibm.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
#ifdef LDBL_IMPLICIT_NBIT
|
||||
#define MANH_SIZE (LDBL_MANH_SIZE + 1)
|
||||
|
|
|
@ -43,7 +43,7 @@ float
|
|||
fmaf(float x, float y, float z)
|
||||
{
|
||||
double xy, result;
|
||||
uint32_t hr, lr;
|
||||
u_int32_t hr, lr;
|
||||
|
||||
xy = (double)x * y;
|
||||
result = xy + z;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <float.h>
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
/*
|
||||
* A struct dd represents a floating-point number with twice the precision
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
double
|
||||
fmax(double x, double y)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
float
|
||||
fmaxf(float x, float y)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
long double
|
||||
fmaxl(long double x, long double y)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
double
|
||||
fmin(double x, double y)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
float
|
||||
fminf(float x, float y)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
long double
|
||||
fminl(long double x, long double y)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <float.h>
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
#if LDBL_MAX_EXP != 0x4000
|
||||
#error "Unsupported long double format"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <limits.h>
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
int
|
||||
ilogbl(long double x)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
int
|
||||
__isfinite(double d)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
/* Provided by libc */
|
||||
#if 0
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
int
|
||||
__isnormal(double d)
|
||||
|
|
|
@ -18,7 +18,7 @@ static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_logbl.c,v 1.1 2007/12/17 03:
|
|||
#include <limits.h>
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
long double
|
||||
logbl(long double x)
|
||||
|
|
|
@ -40,12 +40,12 @@
|
|||
#include <openlibm.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
#if LDBL_MANL_SIZE > 32
|
||||
#define MASK ((uint64_t)-1)
|
||||
#else
|
||||
#define MASK ((uint32_t)-1)
|
||||
#define MASK ((u_int32_t)-1)
|
||||
#endif
|
||||
/* Return the last n bits of a word, representing the fractional part. */
|
||||
#define GETFRAC(bits, n) ((bits) & ~(MASK << (n)))
|
||||
|
|
|
@ -48,12 +48,12 @@
|
|||
* impossible to use nan(3) portably anyway, so this seems good enough.
|
||||
*/
|
||||
void
|
||||
_scan_nan(uint32_t *words, int num_words, const char *s)
|
||||
_scan_nan(u_int32_t *words, int num_words, const char *s)
|
||||
{
|
||||
int si; /* index into s */
|
||||
int bitpos; /* index into words (in bits) */
|
||||
|
||||
bzero(words, num_words * sizeof(uint32_t));
|
||||
bzero(words, num_words * sizeof(u_int32_t));
|
||||
|
||||
/* Allow a leading '0x'. (It's expected, but redundant.) */
|
||||
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
|
||||
|
@ -80,7 +80,7 @@ nan(const char *s)
|
|||
{
|
||||
union {
|
||||
double d;
|
||||
uint32_t bits[2];
|
||||
u_int32_t bits[2];
|
||||
} u;
|
||||
|
||||
_scan_nan(u.bits, 2, s);
|
||||
|
@ -97,7 +97,7 @@ nanf(const char *s)
|
|||
{
|
||||
union {
|
||||
float f;
|
||||
uint32_t bits[1];
|
||||
u_int32_t bits[1];
|
||||
} u;
|
||||
|
||||
_scan_nan(u.bits, 1, s);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <float.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <float.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <float.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <float.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
#include "openlibm.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
@ -25,13 +25,13 @@
|
|||
#if LDBL_MANL_SIZE > 32
|
||||
typedef uint64_t manl_t;
|
||||
#else
|
||||
typedef uint32_t manl_t;
|
||||
typedef u_int32_t manl_t;
|
||||
#endif
|
||||
|
||||
#if LDBL_MANH_SIZE > 32
|
||||
typedef uint64_t manh_t;
|
||||
#else
|
||||
typedef uint32_t manh_t;
|
||||
typedef u_int32_t manh_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <float.h>
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
#if LDBL_MAX_EXP != 0x4000
|
||||
/* We also require the usual bias, min exp and expsign packing. */
|
||||
|
@ -55,7 +55,7 @@ long double
|
|||
rintl(long double x)
|
||||
{
|
||||
union IEEEl2bits u;
|
||||
uint32_t expsign;
|
||||
u_int32_t expsign;
|
||||
int ex, sign;
|
||||
|
||||
u.e = x;
|
||||
|
|
|
@ -31,7 +31,7 @@ static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_scalbnl.c,v 1.1 2005/03/07 0
|
|||
#include <float.h>
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
#if LDBL_MAX_EXP != 0x4000
|
||||
#error "Unsupported long double format"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <openlibm.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
int
|
||||
__signbit(double d)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <openlibm.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "fpopenlibm.h"
|
||||
#include "fpmath.h"
|
||||
|
||||
#ifdef LDBL_IMPLICIT_NBIT
|
||||
#define MANH_SIZE (LDBL_MANH_SIZE + 1)
|
||||
|
|
Loading…
Reference in a new issue