You need to sign in or sign up before continuing.
提交 9560b6b1 编写于 作者: N nsz

remove libm.h includes when math.h and float.h are enough

上级 df8b3e5a
#include "libm.h" #include <math.h>
double fdim(double x, double y) double fdim(double x, double y)
{ {
......
#include "libm.h" #include <math.h>
float fdimf(float x, float y) float fdimf(float x, float y)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fdiml(long double x, long double y) long double fdiml(long double x, long double y)
......
#include "libm.h" #include <math.h>
double fmax(double x, double y) double fmax(double x, double y)
{ {
......
#include "libm.h" #include <math.h>
float fmaxf(float x, float y) float fmaxf(float x, float y)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fmaxl(long double x, long double y) long double fmaxl(long double x, long double y)
......
#include "libm.h" #include <math.h>
double fmin(double x, double y) double fmin(double x, double y)
{ {
......
#include "libm.h" #include <math.h>
float fminf(float x, float y) float fminf(float x, float y)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fminl(long double x, long double y) long double fminl(long double x, long double y)
......
...@@ -11,7 +11,6 @@ int ilogb(double x) ...@@ -11,7 +11,6 @@ int ilogb(double x)
if (u.bits == 0) if (u.bits == 0)
return FP_ILOGB0; return FP_ILOGB0;
/* subnormal x */ /* subnormal x */
// FIXME: scale up subnormals with a *0x1p53 or find top set bit with a better method
for (e = -0x3ff; u.bits < (uint64_t)1<<63; e--, u.bits<<=1); for (e = -0x3ff; u.bits < (uint64_t)1<<63; e--, u.bits<<=1);
return e; return e;
} }
......
#include "libm.h" #include <math.h>
double ldexp(double x, int n) double ldexp(double x, int n)
{ {
......
#include "libm.h" #include <math.h>
float ldexpf(float x, int n) float ldexpf(float x, int n)
{ {
......
#include "libm.h" #include <math.h>
long double ldexpl(long double x, int n) long double ldexpl(long double x, int n)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long long llrintl(long double x) long long llrintl(long double x)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long long llroundl(long double x) long long llroundl(long double x)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long lrintl(long double x) long lrintl(long double x)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long lroundl(long double x) long lroundl(long double x)
{ {
......
#include <fenv.h> #include <fenv.h>
#include "libm.h" #include <math.h>
/* /*
rint may raise inexact (and it should not alter the fenv otherwise) rint may raise inexact (and it should not alter the fenv otherwise)
......
#include <fenv.h> #include <fenv.h>
#include "libm.h" #include <math.h>
float nearbyintf(float x) { float nearbyintf(float x) {
fenv_t e; fenv_t e;
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double nearbyintl(long double x) long double nearbyintl(long double x)
{ {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
*/ */
#include "libm.h" #include "libm.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
double nexttoward(double x, long double y) double nexttoward(double x, long double y)
{ {
......
#include "libm.h" #include <math.h>
long double nexttowardl(long double x, long double y) long double nexttowardl(long double x, long double y)
{ {
......
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double remainderl(long double x, long double y) long double remainderl(long double x, long double y)
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libm.h" #include <math.h>
double round(double x) double round(double x)
{ {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libm.h" #include <math.h>
float roundf(float x) float roundf(float x)
{ {
......
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double roundl(long double x) long double roundl(long double x)
{ {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* should use scalbn() instead. * should use scalbn() instead.
*/ */
#include "libm.h" #include <math.h>
double scalb(double x, double fn) double scalb(double x, double fn)
{ {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* ==================================================== * ====================================================
*/ */
#include "libm.h" #include <math.h>
float scalbf(float x, float fn) float scalbf(float x, float fn)
{ {
......
#include <limits.h> #include <limits.h>
#include "libm.h" #include <math.h>
double scalbln(double x, long n) double scalbln(double x, long n)
{ {
......
#include <limits.h> #include <limits.h>
#include "libm.h" #include <math.h>
float scalblnf(float x, long n) float scalblnf(float x, long n)
{ {
......
#include <limits.h> #include <limits.h>
#include "libm.h" #include <math.h>
#include <float.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double scalblnl(long double x, long n) long double scalblnl(long double x, long n)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册