Solved

Q for rosefire:  Neg 0s in IEEE 754

Posted on 1998-12-15
7
319 Views
Last Modified: 2012-05-04
Hi rosefire;

I gave the points for the last question to ozo, but I am interseted in what you brought up.  Could you give me more info on what types of problems an application would have with a negative zero representation?

Thanks,

Matt
0
Comment
Question by:MatthewL
  • 3
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
rosefire earned 50 total points
ID: 1013697
Floating-point arithmetic on digital computers is inexact. The 23 bits plus the hidden bit of mantissa in a 32-bit floating-point number equates to roughly  7 significant digits. As I am sure you know, floating-point systems differ from real numbers in that they have gaps between each number. If a number is not exactly representable, then it must be approximated by one of the nearest representable values.  This can be positive zero, or it can be negative zero.

Because the same number of bits are used to represent all normalized numbers, the smaller the exponent, the greater the proximity  of representable numbers. For example, there are approximately 8.3 million single-precision numbers between 1.0 and 2.0, while there are only about 8k between 1023.0 and 1024.0.

On any computer, mathematically equivalent expressions can produce different results. In this example, Z and Z1 will typically have different values because (1/Y) or 1/7 is not exactly representable in binary floating-point:

REAL X, Y, Y1, Z, Z1
DATA X/77777/, Y/7/
Y1 = 1 / Y
Z = X / Y
Z1 = X * Y1
IF (Z .NE. Z1) PRINT *, 'Not equal!'
END

A programmer has to keep the inexact nature of the floating point number in mind when writing a program where rounding can take you to either to a negative or positive zero when rounding.  Unexpected cases can arise.

The vast majority of problems with positive and negative zero representations are ones that are a result of programmers failure to handle the negative zero rounding case properly.  Programs will work and seem bug free but make mistakes with corner cases that arise infrequently.    Intel got burned on such a rounding problem pretty good if you recall.

Hope that helps.  If you have any further questions, let me know.

RoseFire
0
 
LVL 84

Expert Comment

by:ozo
ID: 1013698
The problem of inexactness in floating point representations exists regardless of how many kinds of zero there are.
0
 
LVL 1

Author Comment

by:MatthewL
ID: 1013699
Once again thanks to you both.

So does this mean the potential problem would be with a JS or JL instruction incorrectly ( in our interpretation ) jumping?

Matt
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 3

Expert Comment

by:rosefire
ID: 1013700
I don't understand your last question.  I don't know the particulars of the problem with the long and short jump problem you refer to.

RoseFire
0
 
LVL 1

Author Comment

by:MatthewL
ID: 1013701
Hi rosefire;

I was just trying to think of where the problems would occur.  So I thought maybe on JS ( jump on sign) would jump on a negative 0 but not on a positive 0 and therefore create an inconsistency.  Is this a correct interpretation?

Matt
0
 
LVL 3

Expert Comment

by:rosefire
ID: 1013702
Actually, I don't know compilers well enough to answer that, but i would hope that a complier would know the difference between negative and positive zero.  Now, if you are an assembly language programmer, the outcome could be ambiguous but he hardware should ignore the sign bit in doing the compare if it is IEEE compliant.

Hope that helps.

RoseFire
0
 
LVL 1

Author Comment

by:MatthewL
ID: 1013703
Thanks,


Matt
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
general question about new tv 7 66
DVD BURNER 2 35
evulating CPU from family/model/stepping #s 6 30
Can I install Windows on a Chromebook? 3 47
this article is a guided solution for most of the common server issues in server hardware tasks we are facing in our routine job works. the topics in the following article covered are, 1) dell hardware raidlevel (Perc) 2) adding HDD 3) how t…
Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question