# Re: IEEE 754 support and implications

From: Richard <richard.rankin_at_ieee.org>
Date: Sun, 21 Aug 2011 17:47:40 -0700 (PDT)

IEEE Standard 754 floating point is the most common representation in use today for real numbers on computers, including Intel-based PC's, Macintoshes, and most Unix platforms. This is binary, unlike the other oracle datatypes. Math with this type is much faster. Use with the type in C, Java, Ada, etc. requires no conversion from Oracle. It's stored like this:

A number of this format consists of a sign bit, an exponent and a mantissa. The mantissa consists of the value an implicit leading bit, a binary point and then the value of the faction bits (ƒ) and thus 1.ƒ

```                             Sign    Exponent     Fraction     Bias

Single Precision    1 [31]      8 [30-23]    23 [22-00]    127
```
Double Precision 1 [63] 11 [62-52] 52 [51-00] 1023

Single precision is 32-bits. Double is 64 bits. Bit 1 is the sign. The exponent is length[bits]. The fraction is length[bits]. Since the exponent can be + or -, the bias is added to the actual exponent to get the stored exponent. Thus for single precision, a stored exponent of 127 means an exponent of zero and a stored exponent of 200 equals an exponent of 73.

An exponent field of all zeros and a fraction field of all zeros denotes a value of zero, if the exponent field is all 1's and the fraction field is all 0's, value is infinity. Because of the sign bit, both can be + or -.

If an exponent field of all 0's but the faction field is non-zero then value is a denormalized number. In this case the leading bit before the binary point is not assumed to be 1.

An exponent of all 1's and a non-zero fraction is Not a Number (NaN). There are two kinds of Nan:

QNaN in which the most significant fraction bit is set and SNaN in which the most significant fraction bit is clear. A QNaN (or Quiet NaN) propogates freely through arithmetic operations and are the result of operations where the result is undefined (indeterminate). SNaN denotes the results of invalid operaations.Only the latter throw exceptions.

On Aug 20, 5:33 pm, John Hurley <hurleyjo..._at_yahoo.com> wrote:
> Richard:
>
> # I would like to know more about the purpose, use and misuse of these
> datatypes.
>
> ...
>
> Most of the Oracle world or at least the part that I have seen uses
> NUMBER in some manner for tables.
>
> Probably the other ones were put in for standards compatibility.
>
> Have you tried searching for stuff related to this at asktom?
Received on Sun Aug 21 2011 - 19:47:40 CDT

Original text of this message