65 #include "softfloat-macros" 75 #include "softfloat-specialize" 85 return a &
LIT64 (0x000FFFFFFFFFFFFF);
97 return (a >> 52) & 0x7FF;
128 return (((
bits64) zSign) << 63) + (((
bits64) zExp) << 52) + zSig;
158 flag roundNearestEven, isTiny;
159 int16 roundIncrement, roundBits;
163 roundIncrement = 0x200;
164 if (!roundNearestEven)
172 roundIncrement = 0x3FF;
185 roundBits = zSig & 0x3FF;
186 if (0x7FD <= (
bits16) zExp)
189 || ((zExp == 0x7FD) && ((
sbits64) (zSig + roundIncrement) < 0)))
192 return packFloat64 (zSign, 0x7FF, 0) - (roundIncrement == 0);
198 || (zSig + roundIncrement <
LIT64 (0x8000000000000000));
199 shift64RightJamming (zSig, -zExp, &zSig);
201 roundBits = zSig & 0x3FF;
202 if (isTiny && roundBits)
208 zSig = (zSig + roundIncrement) >> 10;
209 zSig &= ~(((roundBits ^ 0x200) == 0) & roundNearestEven);
230 shiftCount = countLeadingZeros64 (zSig) - 1;
246 int16 aExp, bExp, zExp;
254 expDiff = aExp - bExp;
262 return propagateFloat64NaN (a, b);
268 bSig |=
LIT64 (0x2000000000000000);
269 shift64RightJamming (bSig, expDiff, &bSig);
272 else if (expDiff < 0)
277 return propagateFloat64NaN (a, b);
284 aSig |=
LIT64 (0x2000000000000000);
286 shift64RightJamming (aSig, -expDiff, &aSig);
294 return propagateFloat64NaN (a, b);
299 zSig =
LIT64 (0x4000000000000000) + aSig + bSig;
303 aSig |=
LIT64 (0x2000000000000000);
304 zSig = (aSig + bSig) << 1;
327 int16 aExp, bExp, zExp;
335 expDiff = aExp - bExp;
345 return propagateFloat64NaN (a, b);
347 return float64_default_nan;
363 return propagateFloat64NaN (a, b);
369 aSig |=
LIT64 (0x4000000000000000);
370 shift64RightJamming (aSig, -expDiff, &aSig);
371 bSig |=
LIT64 (0x4000000000000000);
376 goto normalizeRoundAndPack;
381 return propagateFloat64NaN (a, b);
387 bSig |=
LIT64 (0x4000000000000000);
388 shift64RightJamming (bSig, expDiff, &bSig);
389 aSig |=
LIT64 (0x4000000000000000);
393 normalizeRoundAndPack:
INLINE int16 extractFloat64Exp(float64 a)
INLINE flag extractFloat64Sign(float64 a)
unsigned short int bits16
INLINE float64 packFloat64(flag zSign, int16 zExp, bits64 zSig)
#define float_flag_invalid
float64 float64_add(float64 a, float64 b)
static float64 roundAndPackFloat64(flag zSign, int16 zExp, bits64 zSig)
#define float_flag_overflow
#define float_flag_underflow
#define float_tininess_before_rounding
unsigned long long float64
static float64 subFloat64Sigs(float64 a, float64 b, flag zSign)
float64 __attribute__((noinline))
static float64 addFloat64Sigs(float64 a, float64 b, flag zSign)
int8 float_exception_flags
#define float_round_nearest_even
signed long long int sbits64
#define float_flag_inexact
#define float_round_to_zero
static float64 normalizeRoundAndPackFloat64(flag zSign, int16 zExp, bits64 zSig)
INLINE bits64 extractFloat64Frac(float64 a)
unsigned long long int bits64