License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define _FP_DECL(wc, X) \
- _FP_I_TYPE X##_c __attribute__((unused)), X##_s, X##_e; \
+#define _FP_DECL(wc, X) \
+ _FP_I_TYPE X##_c __attribute__((unused)); \
+ _FP_I_TYPE X##_s __attribute__((unused)); \
+ _FP_I_TYPE X##_e; \
_FP_FRAC_DECL_##wc(X)
/*
#define _FP_PACK_SEMIRAW(fs, wc, X) \
do { \
_FP_ROUND(wc, X); \
+ if (X##_e == 0 && !_FP_FRAC_ZEROP_##wc(X)) \
+ { \
+ if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
+ || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
+ FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ } \
if (_FP_FRAC_HIGH_##fs(X) \
& (_FP_OVERFLOW_##fs >> 1)) \
{ \
_FP_OVERFLOW_SEMIRAW(fs, wc, X); \
} \
_FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
- if (!_FP_EXP_NORMAL(fs, wc, X) && !_FP_FRAC_ZEROP_##wc(X)) \
+ if (X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
{ \
- if (X##_e == 0) \
+ if (!_FP_KEEPNANFRACP) \
{ \
- if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
- || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
- FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
+ X##_s = _FP_NANSIGN_##fs; \
} \
else \
- { \
- if (!_FP_KEEPNANFRACP) \
- { \
- _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
- X##_s = _FP_NANSIGN_##fs; \
- } \
- else \
- _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_QNANBIT_##fs; \
- } \
+ _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_QNANBIT_##fs; \
} \
} while (0)
#define _FP_MUL(fs, wc, R, X, Y) \
do { \
R##_s = X##_s ^ Y##_s; \
+ R##_e = X##_e + Y##_e + 1; \
switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
{ \
case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
R##_c = FP_CLS_NORMAL; \
- R##_e = X##_e + Y##_e + 1; \
\
_FP_MUL_MEAT_##fs(R,X,Y); \
\
#define _FP_DIV(fs, wc, R, X, Y) \
do { \
R##_s = X##_s ^ Y##_s; \
+ R##_e = X##_e - Y##_e; \
switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
{ \
case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
R##_c = FP_CLS_NORMAL; \
- R##_e = X##_e - Y##_e; \
\
_FP_DIV_MEAT_##fs(R,X,Y); \
break; \