Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions amd64/bsd_ieeefp.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_

#if !defined(_SYS_CDEFS_H) && !defined(_SYS_CDEFS_H_) && !defined(_CDEFS_H_)
#error this file needs sys/cdefs.h as a prerequisite
#endif

/*
* FP rounding modes
*/
Expand Down
6 changes: 3 additions & 3 deletions bsdsrc/b_exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ double x, c;
c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5))));
c = (x*c)/(2.0-c);

return scalb(1.+(hi-(lo - c)), k);
return scalbn(1.+(hi-(lo - c)), k);
}
/* end of x > lntiny */

else
/* exp(-big#) underflows to zero */
if(finite(x)) return(scalb(1.0,-5000));
if(isfinite(x)) return(scalbn(1.0,-5000));

/* exp(-INF) is zero */
else return(0.0);
Expand All @@ -167,5 +167,5 @@ double x, c;

else
/* exp(INF) is INF, exp(+big#) overflows to INF */
return( finite(x) ? scalb(1.0,5000) : x);
return( isfinite(x) ? scalbn(1.0,5000) : x);
}
2 changes: 1 addition & 1 deletion bsdsrc/b_tgamma.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ tgamma(x)
if (x != 0.0)
u.a = one - tiny; /* raise inexact */
return (one/x);
} else if (!finite(x))
} else if (!isfinite(x))
return (x - x); /* x is NaN or -Inf */
else
return (neg_gam(x));
Expand Down
15 changes: 5 additions & 10 deletions include/cdefs-compat.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#ifndef _CDEFS_COMPAT_H_
#define _CDEFS_COMPAT_H_

#ifndef _WIN32
#include "sys/cdefs.h"
#else /* _WIN32 */
/*
* We cannot be certain that this operating system has <sys/cdefs.h>.
* Instead, include a header file that is likely to pull in this header.
*/
#include <stdio.h>

#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
Expand All @@ -13,13 +15,6 @@
#define __END_DECLS
#endif

#define _SYS_CDEFS_H_

#endif /* _WIN32 */




#ifdef __GNUC__
#ifndef __strong_reference
#ifdef __APPLE__
Expand Down
24 changes: 17 additions & 7 deletions include/fpmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,37 @@
#endif
#endif

#ifdef __linux
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)

/* Definitions provided directly by GCC and Clang. */
#define _LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
#define _BIG_ENDIAN __ORDER_BIG_ENDIAN__
#define _PDP_ENDIAN __ORDER_PDP_ENDIAN__
#define _BYTE_ORDER __BYTE_ORDER__

#elif defined(__linux)

#include <features.h>
#include <endian.h>
#define _LITTLE_ENDIAN __LITTLE_ENDIAN
#define _BIG_ENDIAN __BIG_ENDIAN
#define _PDP_ENDIAN __PDP_ENDIAN
#define _BYTE_ORDER __BYTE_ORDER
#endif

#ifdef __APPLE__
#elif defined(__APPLE__)

#include <machine/endian.h>
#define _LITTLE_ENDIAN LITTLE_ENDIAN
#define _BIG_ENDIAN BIG_ENDIAN
#define _PDP_ENDIAN PDP_ENDIAN
#define _BYTE_ORDER BYTE_ORDER
#endif

#ifdef __FreeBSD__
#elif defined(__FreeBSD__)

#include <machine/endian.h>
#endif

#ifdef _WIN32
#elif defined(_WIN32)

#define _LITTLE_ENDIAN 1234
#define _BIG_ENDIAN 4321
#define _PDP_ENDIAN 3412
Expand All @@ -69,6 +78,7 @@
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
#define BYTE_ORDER _BYTE_ORDER

#endif

#ifndef _IEEE_WORD_ORDER
Expand Down
2 changes: 1 addition & 1 deletion src/e_scalb.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ __ieee754_scalb(double x, double fn)
return scalbn(x,fn);
#else
if (isnan(x)||isnan(fn)) return x*fn;
if (!finite(fn)) {
if (!isfinite(fn)) {
if(fn>0.0) return x*fn;
else return x/(-fn);
}
Expand Down
4 changes: 2 additions & 2 deletions src/e_scalbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ __ieee754_scalbf(float x, float fn)
#ifdef _SCALB_INT
return scalbnf(x,fn);
#else
if ((__isnanf)(x)||(__isnanf)(fn)) return x*fn;
if (!finitef(fn)) {
if (isnan(x)||isnan(fn)) return x*fn;
if (!isfinite(fn)) {
if(fn>(float)0.0) return x*fn;
else return x/(-fn);
}
Expand Down
4 changes: 0 additions & 4 deletions src/math_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ double __kernel_sin(double,double,int);
double __kernel_cos(double,double);
double __kernel_tan(double,double,int);
double __ldexp_exp(double,int);
#ifdef _COMPLEX_H
double complex __ldexp_cexp(double complex,int);
#endif

/* float precision kernel functions */
#ifdef INLINE_REM_PIO2F
Expand All @@ -355,9 +353,7 @@ __inline
#endif
float __kernel_tandf(double,int);
float __ldexp_expf(float,int);
#ifdef _COMPLEX_H
float complex __ldexp_cexpf(float complex,int);
#endif

/* long double precision kernel functions */
long double __kernel_sinl(long double, long double, int);
Expand Down
2 changes: 2 additions & 0 deletions src/openlibm.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ extern const union __nan_un {
//VBS begin
#define __MATH_BUILTIN_CONSTANTS
#define __MATH_BUILTIN_RELOPS
#ifndef __ISO_C_VISIBLE
#define __ISO_C_VISIBLE 1999
#endif
//VBS end

#ifdef __MATH_BUILTIN_CONSTANTS
Expand Down