Skip to content

Commit 321ed3e

Browse files
committed
Manual merge jwakely <cmath> corrections
1 parent 941fe25 commit 321ed3e

File tree

1 file changed

+48
-15
lines changed

1 file changed

+48
-15
lines changed

include/cmath

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,55 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
611611
#undef islessgreater
612612
#undef isunordered
613613

614+
#if defined(FP_NAN)
615+
#undef FP_NAN
616+
#endif
617+
#if defined(FP_INFINITE)
618+
#undef FP_INFINITE
619+
#endif
620+
#if defined(FP_ZERO)
621+
#undef FP_ZERO
622+
#endif
623+
#if defined(FP_SUBNORMAL)
624+
#undef FP_SUBNORMAL
625+
#endif
626+
#if defined(FP_NORMAL)
627+
#undef FP_NORMAL
628+
#endif
629+
630+
#define FP_NAN 0
631+
#define FP_INFINITE 1
632+
#define FP_ZERO 2
633+
#define FP_SUBNORMAL 3
634+
#define FP_NORMAL 4
635+
614636
#if __cplusplus >= 201103L
615637

638+
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
639+
constexpr int
640+
fpclassify(float __x)
641+
{ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
642+
FP_SUBNORMAL, FP_ZERO, __x); }
643+
644+
constexpr int
645+
fpclassify(double __x)
646+
{ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
647+
FP_SUBNORMAL, FP_ZERO, __x); }
648+
649+
constexpr int
650+
fpclassify(long double __x)
651+
{ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
652+
FP_SUBNORMAL, FP_ZERO, __x); }
653+
#endif
654+
655+
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
656+
template<typename _Tp>
657+
constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
658+
int>::__type
659+
fpclassify(_Tp __x)
660+
{ return __x != 0 ? FP_NORMAL : FP_ZERO; }
661+
#endif
662+
616663
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
617664
constexpr bool
618665
isfinite(float __x)
@@ -890,21 +937,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
890937
}
891938
#endif
892939

893-
#if !defined(FP_NAN)
894-
#define FP_NAN 0
895-
#endif
896-
#if !defined(FP_INFINITE)
897-
#define FP_INFINITE 1
898-
#endif
899-
#if !defined(FP_ZERO)
900-
#define FP_ZERO 2
901-
#endif
902-
#if !defined(FP_SUBNORMAL)
903-
#define FP_SUBNORMAL 3
904-
#endif
905-
#if !defined(FP_NORMAL)
906-
#define FP_NORMAL 4
907-
#endif
940+
#else
908941

909942
template<typename _Tp>
910943
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,

0 commit comments

Comments
 (0)