Oracle NUMBER Comparisons
Yes, Oracle NUMBER types are precise. They're more like integers with a scale than float/double types. So a NUMBER(10,3) has 10 digits, 3 after the decimal point, which is really a 10 digit integer with a scale of 3. In fact, that's precise how Java BigDecimals work (being a BigInteger plus a scale internally).
Oracle NUMBER
types are stored as sets of centesimal digits (that is base 100
, not base 10
), one digit per byte.
The first byte represents the exponent, other bytes represent mantissa.
That means that for extremely large numbers, even the integer numbers can be rounded:
SELECT 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001FROM dual---0
Oracle guarantees 38 digits of precision in a NUMBER, although 40 can be represented. See Oracle Concepts for a reference.