Lines Matching full:mantissa

47 // has a fixed-width mantissa and power of two exponent.  For example, a normal
48 // `double` has a 53-bit mantissa. Because the high bit is always 1, it is not
57 // is represented as a subnormal with an all-bits-zero mantissa.)
59 // The code below, in calculations, represents the mantissa as a uint64_t. The
80 // The number of mantissa bits in the given float type. This includes the
84 // The largest supported IEEE exponent, in our integral mantissa
91 // The smallest supported IEEE normal exponent, in our integral mantissa
139 // This is intended to do the same operation as ldexp(mantissa, exponent),
146 // `mantissa` must either be exactly kTargetMantissaBits wide, in which case
150 static double Make(mantissa_t mantissa, int exponent, bool sign) { in Make()
155 return sign ? -ldexp(mantissa, exponent) : ldexp(mantissa, exponent); in Make()
160 if (mantissa > kMantissaMask) { in Make()
163 // 52 due to the implied decimal point in the IEEE mantissa in Make()
167 mantissa &= kMantissaMask; in Make()
172 dbl += mantissa; in Make()
210 static float Make(mantissa_t mantissa, int exponent, bool sign) { in Make()
215 return sign ? -ldexpf(mantissa, exponent) : ldexpf(mantissa, exponent); in Make()
220 if (mantissa > kMantissaMask) { in Make()
223 // 23 due to the implied decimal point in the IEEE mantissa in Make()
227 mantissa &= kMantissaMask; in Make()
232 flt += mantissa; in Make()
238 // Decimal-to-binary conversions require coercing powers of 10 into a mantissa
286 // Returns true if n is small enough that 10**n times a ParsedFloat mantissa
303 // The calculated number is mantissa * 2**exponent (mantissa is treated as an
304 // integer.) `mantissa` is chosen to be the correct width for the IEEE float
305 // representation being calculated. (`mantissa` will always have the same bit
311 uint64_t mantissa = 0; member
326 // Calculates how far to the right a mantissa needs to be shifted to create a
327 // properly adjusted mantissa for an IEEE floating point number.
329 // `mantissa_width` is the bit width of the mantissa to be shifted, and
394 if (input.mantissa == 0) { in HandleEdgeCase()
416 } else if (calculated.mantissa == 0 || calculated.exponent == kUnderflow) { in EncodeResult()
423 calculated.mantissa), in EncodeResult()
433 // be the correct bit-width for the target mantissa, which is strictly narrower
464 // mantissa (which represents underflow). in ShiftRightAndRound()
517 // hundreds of digits of mantissa.) in MustRoundUp()
572 // Constructs a CalculatedFloat from a given mantissa and exponent, but
575 // If rounding has caused mantissa to increase just past the allowed bit
580 // If mantissa is zero (representing a non-zero value not representable, even
583 CalculatedFloat CalculatedFloatFromRawValues(uint64_t mantissa, int exponent) { in CalculatedFloatFromRawValues() argument
585 if (mantissa == uint64_t{1} << FloatTraits<FloatType>::kTargetMantissaBits) { in CalculatedFloatFromRawValues()
586 mantissa >>= 1; in CalculatedFloatFromRawValues()
591 } else if (mantissa == 0) { in CalculatedFloatFromRawValues()
595 result.mantissa = mantissa; in CalculatedFloatFromRawValues()
603 uint64_t mantissa = parsed_hex.mantissa; in CalculateFromParsedHexadecimal() local
607 int mantissa_width = static_cast<int>(bit_width(mantissa)); in CalculateFromParsedHexadecimal()
611 mantissa = ShiftRightAndRound(mantissa, shift, in CalculateFromParsedHexadecimal()
615 return CalculatedFloatFromRawValues<FloatType>(mantissa, exponent); in CalculateFromParsedHexadecimal()
634 // mantissa, and multiply this by our parsed decimal mantissa. in CalculateFromParsedDecimal()
635 uint128 wide_binary_mantissa = parsed_decimal.mantissa; in CalculateFromParsedDecimal()
647 // Truncated mantissa in CalculateFromParsedDecimal()
653 // Exact mantissa, truncated power of ten in CalculateFromParsedDecimal()
664 // Shift into an FloatType-sized mantissa, and round to nearest. in CalculateFromParsedDecimal()
692 uint64_t man = input.mantissa; in EiselLemire()
722 // bias, 52 mantissa bits), but the same approach applies to single precision in EiselLemire()
723 // (8 exponent bits with a -127 bias, 23 mantissa bits). Either way, the in EiselLemire()
937 // A nullptr subrange_begin means that the decimal_parse.mantissa is exact in FromCharsImpl()
969 // mantissa. The high bit is always on.
971 // kPower10MantissaLowTable extends that 64-bit mantissa to 128 bits.
985 // so we do not have to do further shifting to deduce the 128-bit mantissa: