65 #include "softfloat-macros" 75 #include "softfloat-specialize" 85 return a &
LIT64 (0x000FFFFFFFFFFFFF);
97 return (a >> 52) & 0x7FF;
125 shiftCount = countLeadingZeros64 (aSig) - 11;
126 *zSigPtr = aSig << shiftCount;
127 *zExpPtr = 1 - shiftCount;
146 return (((
bits64) zSign) << 63) + (((
bits64) zExp) << 52) + zSig;
176 flag roundNearestEven, isTiny;
177 int16 roundIncrement, roundBits;
181 roundIncrement = 0x200;
182 if (!roundNearestEven)
190 roundIncrement = 0x3FF;
203 roundBits = zSig & 0x3FF;
204 if (0x7FD <= (
bits16) zExp)
207 || ((zExp == 0x7FD) && ((
sbits64) (zSig + roundIncrement) < 0)))
210 return packFloat64 (zSign, 0x7FF, 0) - (roundIncrement == 0);
216 || (zSig + roundIncrement <
LIT64 (0x8000000000000000));
217 shift64RightJamming (zSig, -zExp, &zSig);
219 roundBits = zSig & 0x3FF;
220 if (isTiny && roundBits)
226 zSig = (zSig + roundIncrement) >> 10;
227 zSig &= ~(((roundBits ^ 0x200) == 0) & roundNearestEven);
243 flag aSign, bSign, zSign;
244 int16 aExp, bExp, zExp;
246 bits64 rem0, rem1, term0, term1;
254 zSign = aSign ^ bSign;
258 return propagateFloat64NaN (a, b);
262 return propagateFloat64NaN (a, b);
264 return float64_default_nan;
271 return propagateFloat64NaN (a, b);
278 if ((aExp | aSig) == 0)
281 return float64_default_nan;
294 zExp = aExp - bExp + 0x3FD;
295 aSig = (aSig |
LIT64 (0x0010000000000000)) << 10;
296 bSig = (bSig |
LIT64 (0x0010000000000000)) << 11;
297 if (bSig <= (aSig + aSig))
302 zSig = estimateDiv128To64 (aSig, 0, bSig);
303 if ((zSig & 0x1FF) <= 2)
305 mul64To128 (bSig, zSig, &term0, &term1);
306 sub128 (aSig, 0, term0, term1, &rem0, &rem1);
310 add128 (rem0, rem1, 0, bSig, &rem0, &rem1);
float64 float64_div(float64 a, float64 b)
INLINE int16 extractFloat64Exp(float64 a)
INLINE flag extractFloat64Sign(float64 a)
#define float_flag_divbyzero
unsigned short int bits16
INLINE float64 packFloat64(flag zSign, int16 zExp, bits64 zSig)
static void normalizeFloat64Subnormal(bits64 aSig, int16 *zExpPtr, bits64 *zSigPtr)
#define float_flag_invalid
#define float_flag_overflow
#define float_flag_underflow
static float64 roundAndPackFloat64(flag zSign, int16 zExp, bits64 zSig)
#define float_tininess_before_rounding
unsigned long long float64
int8 float_exception_flags
#define float_round_nearest_even
signed long long int sbits64
#define float_flag_inexact
#define float_round_to_zero
INLINE bits64 extractFloat64Frac(float64 a)
unsigned long long int bits64