123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #include "cdefs-compat.h"
- #include <openlibm_fenv.h>
- #include <openlibm_math.h>
- #include "math_private.h"
- OLM_DLLEXPORT float
- fmaf(float x, float y, float z)
- {
- double xy, result;
- u_int32_t hr, lr;
- xy = (double)x * y;
- result = xy + z;
- EXTRACT_WORDS(hr, lr, result);
-
- if ((lr & 0x1fffffff) != 0x10000000 ||
- (hr & 0x7ff00000) == 0x7ff00000 ||
- result - xy == z ||
- fegetround() != FE_TONEAREST)
- return (result);
-
- fesetround(FE_TOWARDZERO);
- volatile double vxy = xy;
- double adjusted_result = vxy + z;
- fesetround(FE_TONEAREST);
- if (result == adjusted_result)
- SET_LOW_WORD(adjusted_result, lr + 1);
- return (adjusted_result);
- }
|