|
From: Paul V. <pa...@vi...> - 2016-08-11 10:40:07
|
Hi all, >> Floating point data types are stored in an IEEE 754 binary format that >> comprises sign, exponent and mantissa. Precision is dynamic, >> corresponding to the physical storage format of the value, which may >> be up to 4 bytes for the FLOAT type and up to 8 bytes for DOUBLE >> PRECISION. > > It's exactly either 4 or 8 bytes, not "up to". The storage used is 4 or 8 bytes, but the precision is less, because a number of bits are used for sign and exponent. FLOAT precision is 24 bits - roughly 7 decimal digits. The binary exponent's range is -126..127, which - again, roughly - corresponds to -38..38 base 10. DOUBLE precision is 53 bits (around 16 decimal digits) and the exponent ranges from -1022 to 1023 binary or roughly -308 to 308 decimal. The precision is not dynamic (except when precision is lost because the number is too small to be normalized, but I think that's outside the scope of an SQL reference). Cheers, Paul |