October 14th, 2008

Approximate Numeric Data, Part 1 of 2

Posted by admin in F. Data Types

Some numeric values are of such a very large or very small value (many magnitudes) that the computer registers can not contain the entire value. Depending on the computer system, registers are typically 32-bit, 64-bit, 128-bit, or 256-bit in length. Usually, in these cases, exactness is not necessary and a close approximation is acceptable.

> The value can be negative, zero, or positive.

> It is a floating-point number expressed in scientific notation.

> SQL:2003 introduced REAL, DOUBLE PRECISION, and FLOAT(precisionbits) data types.
> Systems that allow REAL gives a single-precision floating-point number.
> Systems that allow DOUBLE PRECISION gives a double-precision floating-point number, so it is twice the precision of a REAL definition.
> The actual precision of REAL and DOUBLE PRECISION depends on the RDBMS vendor’s implementation.
> Using FLOAT rather than REAL or DOUBLE PRECISION makes moving your database to a different computer easier, because the FLOAT data type allows you to specify precision.
> If you have a choice between exact DECIMAL (or NUMERIC) or approximate FLOAT (or REAL), use the exact data type, because you get completely accurate numbers and it processes faster. Approximate data type should be used only for very extreme ranges of numeric values.
> PostgreSQL converts FLOAT to DOUBLE PRECISION.

Comments are closed.

Sorry, the comment form is closed at this time.