1616#include < quadmath.h>
1717
1818#if __cplusplus >= 201103L
19+ /* for fpclassify return values */
1920 #include < cmath>
20- #include < cfenv>
2121#endif
2222
2323/* Classification */
@@ -31,9 +31,11 @@ inline bool issignaling(__float128 x) { return (issignalingq(x) != 0); }
3131inline bool isunordered (__float128 x, __float128 y) {
3232 return ((isnanq (x) != 0 ) || (isnanq (y) != 0 ));
3333}
34+
3435inline bool isnormal (__float128 x) {
3536 return ((finiteq (x) != 0 ) && (fabsq (x) >= FLT128_MIN));
3637}
38+
3739inline bool issubnormal (__float128 x) {
3840 return ((finiteq (x) != 0 ) && (fabsq (x) < FLT128_MIN) && (x != static_cast <__float128>(0.0 )));
3941}
@@ -57,49 +59,40 @@ inline bool islessgreater(__float128 x, __float128 y) {
5759 return ((x != y) && (isnanq (x) == 0 ) && (isnanq (y) == 0 ));
5860}
5961
60- #if __cplusplus >= 201103L
61-
6262inline bool isless (__float128 x, __float128 y) {
63- bool ignore_fe_expection = ! std::fetestexcept (FE_INVALID);
64- bool result = (x < y) ;
65- if (ignore_fe_expection) { std::feclearexcept (FE_INVALID); }
66- return result ;
63+ if (( isnanq (x) != 0 ) || ( isnanq (y) != 0 )) {
64+ return false ;
65+ }
66+ return (x < y) ;
6767}
68+
6869inline bool islessequal (__float128 x, __float128 y) {
69- bool ignore_fe_expection = ! std::fetestexcept (FE_INVALID);
70- bool result = (x <= y) ;
71- if (ignore_fe_expection) { std::feclearexcept (FE_INVALID); }
72- return result ;
70+ if (( isnanq (x) != 0 ) || ( isnanq (y) != 0 )) {
71+ return false ;
72+ }
73+ return (x <= y) ;
7374}
75+
7476inline bool isgreater (__float128 x, __float128 y) {
75- bool ignore_fe_expection = ! std::fetestexcept (FE_INVALID);
76- bool result = (x > y) ;
77- if (ignore_fe_expection) { std::feclearexcept (FE_INVALID); }
78- return result ;
77+ if (( isnanq (x) != 0 ) || ( isnanq (y) != 0 )) {
78+ return false ;
79+ }
80+ return (x > y) ;
7981}
82+
8083inline bool isgreaterequal (__float128 x, __float128 y) {
81- bool ignore_fe_expection = ! std::fetestexcept (FE_INVALID);
82- bool result = (x >= y) ;
83- if (ignore_fe_expection) { std::feclearexcept (FE_INVALID); }
84- return result ;
84+ if (( isnanq (x) != 0 ) || ( isnanq (y) != 0 )) {
85+ return false ;
86+ }
87+ return (x >= y) ;
8588}
8689
87- #endif /* __cplusplus >= 201103L */
88-
89-
9090/* signaling comparison */
9191
92- #if __cplusplus >= 201103L
93-
9492inline bool iseqsig (__float128 x, __float128 y) {
95- if ((isnanq (x) != 0 ) || (isnanq (y) != 0 )) {
96- std::feraiseexcept (FE_INVALID);
97- }
98- return (x == y);
93+ return ((x >= y) && (x <= y));
9994}
10095
101- #endif /* __cplusplus >= 201103L */
102-
10396/* Manipulation */
10497
10598inline __float128 fabs (__float128 x) { return fabsq (x); }
@@ -110,10 +103,10 @@ inline __float128 nexttoward(__float128 x, long double y) { return nextafterq(x,
110103/* Float Exponents */
111104
112105inline int ilogb (__float128 x) { return ilogbq (x); }
113- inline __float128 frexp (__float128 x, int * exp ) { return frexpq (x, exp ); }
114- inline __float128 ldexp (__float128 x, int exp ) { return ldexpq (x, exp ); }
115- inline __float128 scalbn (__float128 x, int exp ) { return scalbnq (x, exp ); }
116- inline __float128 scalbln (__float128 x, long exp ) { return scalblnq (x, exp ); }
106+ inline __float128 frexp (__float128 x, int * expon ) { return frexpq (x, expon ); }
107+ inline __float128 ldexp (__float128 x, int expon ) { return ldexpq (x, expon ); }
108+ inline __float128 scalbn (__float128 x, int expon ) { return scalbnq (x, expon ); }
109+ inline __float128 scalbln (__float128 x, long expon ) { return scalblnq (x, expon ); }
117110
118111/* Arithmetic */
119112
0 commit comments