dbTalk Databases Forums  

IEEE 754 support and implications

comp.databases.oracle.server comp.databases.oracle.server


Discuss IEEE 754 support and implications in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Richard
 
Posts: n/a

Default IEEE 754 support and implications - 08-20-2011 , 04:28 PM






As of 10g Oracle supports IEEE 754 with 32-bit (5 bytes) BINARY_FLOAT
(BFLOAT) and 64-bit (9 bytes) BINARY_DOUBLE (BDOUBLE). These types are
supported in C, Java, Ada, PL/SQL, etc.These are native machine binary
types which need not be converted from

For these types the following values are supported:

+0
-0
Inf
+Inf
-Inf
NaN (Not a number)

Division by zero does not produce an exception in all cases. These
datatypes are subject to rounding and accuracy errors.

Misuse of these datatypes has caused naval vessels (USS Yorktown,
1997) to become dead in the water and launch vehicles with payload to
be scattered over vast areas (Ariadne, 1996).

I would like to know more about the purpose, use and misuse of these
datatypes.

Reply With Quote
  #2  
Old   
John Hurley
 
Posts: n/a

Default Re: IEEE 754 support and implications - 08-20-2011 , 05:33 PM






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?

Reply With Quote
  #3  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: IEEE 754 support and implications - 08-20-2011 , 06:56 PM



On Sat, 20 Aug 2011 14:28:11 -0700, Richard wrote:

Quote:
Division by zero does not produce an exception in all cases.
Of course not. Chuck Norris can divide by zero. In that case, division by
zero produces a roundkick, not an exception.



--
http://mgogala.byethost5.com

Reply With Quote
  #4  
Old   
Richard
 
Posts: n/a

Default Re: IEEE 754 support and implications - 08-21-2011 , 07:47 PM



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 (DOT) com> wrote:
Quote:
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?

Reply With Quote
  #5  
Old   
John Hurley
 
Posts: n/a

Default Re: IEEE 754 support and implications - 08-22-2011 , 09:40 AM



On Aug 21, 8:47Â*pm, Richard <richard.ran... (AT) ieee (DOT) org> wrote:
Quote:
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 (DOT) 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?
What does that have to do with the pretty well established idea that
people use the Oracle NUMBER datatype most of the time?

Reply With Quote
  #6  
Old   
Richard
 
Posts: n/a

Default Re: IEEE 754 support and implications - 08-22-2011 , 10:11 AM



On Aug 22, 9:40Â*am, John Hurley <hurleyjo... (AT) yahoo (DOT) com> wrote:
Quote:
On Aug 21, 8:47Â*pm, Richard <richard.ran... (AT) ieee (DOT) org> wrote:









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 thus1.Æ’

Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â*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 (DOT) 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?

What does that have to do with the pretty well established idea that
people use the Oracle NUMBER datatype most of the time?
Who said it did? It IS the most widely used datatype in the world. If
you want to work directly with mainstream languages or hardware
without conversion you may want to use this type. It is faster. The
double type can hold a far larger & more accurate floating point value
than the NUMBER datatype. If you're doing science or engineering you
will need to know this type. Oracle didn't put it there for no reason.
The design and its widespread use reflect its utility. You just need
to know what you're doing.

There is and always has been a trade off between usability,
versatility, etc. and ease of use, protection from coding errors, etc.
Bjarne Stroustrup who wrote C++ said "C makes it easy to shoot
yourself in the foot; C++ makes it harder, but when you do it blows
your whole leg off." He also said "I do not think that safety should
be bought at the cost of complicating the expression of good solutions
to real-life problems." Incidentally C is the most widely used
language in the world, more than Java and far more than C++.

Reply With Quote
  #7  
Old   
John Hurley
 
Posts: n/a

Default Re: IEEE 754 support and implications - 08-22-2011 , 11:22 AM



Richard:

# Oracle didn't put it there for no reason.

....

You have me totally confused. Are you answering questions or asking
them?

AFAIK ... I have seen little adoption of this datatype "so far".

Arguing that it should be used unfortunately does not do much to get
it used.

What does Tom Kyte say about it??? What does Steve F say about it???

If you are looking for a positive impact then those are some of the
leading Oracle DBA/Developer evangelists.

Reply With Quote
  #8  
Old   
joel garry
 
Posts: n/a

Default Re: IEEE 754 support and implications - 08-22-2011 , 11:35 AM



On Aug 22, 8:11Â*am, Richard <richard.ran... (AT) ieee (DOT) org> wrote:
Quote:
On Aug 22, 9:40Â*am, John Hurley <hurleyjo... (AT) yahoo (DOT) com> wrote:



On Aug 21, 8:47Â*pm, Richard <richard.ran... (AT) ieee (DOT) org> wrote:

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 (DOT) 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?

What does that have to do with the pretty well established idea that
people use the Oracle NUMBER datatype most of the time?

Who said it did? It IS the most widely used datatype in the world. If
you want to work directly with mainstream languages or hardware
without conversion you may want to use this type. It is faster. The
double type can hold a far larger & more accurate floating point value
than the NUMBER datatype. If you're doing science or engineering you
will need to know this type. Oracle didn't put it there for no reason.
The design and its widespread use reflect its utility. You just need
to know what you're doing.

There is and always has been a trade off between usability,
versatility, etc. and ease of use, protection from coding errors, etc.
Bjarne Stroustrup who wrote C++ said "C makes it easy to shoot
yourself in the foot; C++ makes it harder, but when you do it blows
your whole leg off." He also said "I do not think that safety should
be bought at the cost of complicating the expression of good solutions
to real-life problems." Incidentally C is the most widely used
language in Â*the world, more than Java and far more than C++.
C may be the most widely used language in the world, but that doesn't
mean it is the best idea for application coding. In fact, it is
horrible for application coding. It assumes good and rigorous
programming practices, which don't happen. Note the Yorktown incident
was an NT application: http://catless.ncl.ac.uk/Risks/19.88.html#subj1
This came directly from the military using COTS applications, and the
risks were pointed out before the problems displayed. Risks digest
has long shown examples of C problems, particularly buffer overflows.

Oracle has a lot of stuff that customers have asked for. That merely
shows that customers ask for things, not that customers ask for good
things. Universities put out large numbers of C programmers, so there
is a large ecosystem of those programmers and derived languages.
Again, that doesn't mean that the current situation is the best, or
even good. Some would argue it is bad.

These datatypes exist for historical reasons. There was a time when
it made a difference whether you had hardware accelerator options on
your VAX as to whether you should be using one type or another and how
you should be coding. So what? If you are gathering physics data at
CERN your requirements are different than if you are gathering SEO
information at google, and neither has much to do with the vast
majority of Oracle installations, or nuke plants controlled by
pdp-11's for that matter. So what's your point?

jg
--
@home.com is bogus.
http://www.dailykos.com/story/2011/0...hment-of-U-235

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.