uint64_t bits;
};
+#define FORCE_EVAL(x) do { \
+ if (sizeof(x) == sizeof(float)) { \
+ volatile float __x; \
+ __x = (x); \
+ } else if (sizeof(x) == sizeof(double)) { \
+ volatile double __x; \
+ __x = (x); \
+ } else { \
+ volatile long double __x; \
+ __x = (x); \
+ } \
+} while(0)
+
/* Get two 32 bit ints from a double. */
#define EXTRACT_WORDS(hi,lo,d) \
do { \
if (e == 0x7ff)
return x + x;
/* raise underflow if ux.value is subnormal or zero */
- if (e == 0) {
- volatile double z;
- z = x*x + ux.value*ux.value;
- }
+ if (e == 0)
+ FORCE_EVAL(x*x + ux.value*ux.value);
return ux.value;
}
if (e == 0x7f800000)
return x + x;
/* raise underflow if ux.value is subnormal or zero */
- if (e == 0) {
- volatile float z;
- z = x*x + ux.value*ux.value;
- }
+ if (e == 0)
+ FORCE_EVAL(x*x + ux.value*ux.value);
return ux.value;
}
if (ux.bits.exp == 0x7fff)
return x + x;
/* raise underflow if ux.value is subnormal or zero */
- if (ux.bits.exp == 0) {
- volatile float z;
- z = x*x + ux.value*ux.value;
- }
+ if (ux.bits.exp == 0)
+ FORCE_EVAL(x*x + ux.value*ux.value);
return ux.value;
}
#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
if (ux.bits.exp == 0x7fff)
return x + x;
/* raise underflow if ux.value is subnormal or zero */
- if (ux.bits.exp == 0) {
- volatile float z;
- z = x*x + ux.value*ux.value;
- }
+ if (ux.bits.exp == 0)
+ FORCE_EVAL(x*x + ux.value*ux.value);
return ux.value;
}
#endif
if (e == 0x7ff)
return x + x;
/* raise underflow if ux.value is subnormal or zero */
- if (e == 0) {
- volatile float z;
- z = x*x + ux.value*ux.value;
- }
+ if (e == 0)
+ FORCE_EVAL(x*x + ux.value*ux.value);
return ux.value;
}
#endif
if (e == 0x7f800000)
return x + x;
/* raise underflow if ux.value is subnormal or zero */
- if (e == 0) {
- volatile float z;
- z = x*x + ux.value*ux.value;
- }
+ if (e == 0)
+ FORCE_EVAL(x*x + ux.value*ux.value);
return ux.value;
}