more on this story

How to convert negative zero to positive zero in C? To see what was going on, I played with the debugger and this is what I got: The result is correct. What's wrong with negative zero?

Presumably your application doesn't run in GDB. Surely you will control the formatting of your output. Jiminion It is not a glitch.

Related Content

Although they represent the same value , aspects of Everything in it was carefully crafted and it is really too bad that some C compilers do not fully implement all of its details and provisions. The main difference between 0.

Exponents (Negative & Zero)- Rules Explained & Examples Worked

I did a simple test: Ross III 46k 22 ThomasEding of course, non-standard compilers do non-standard things. It would appear that they are violating the IEEE standard for floating points.

Negative Zero – Hacker Noon

Ross III Jul 23 '13 at Aram Kocharyan 16k 10 61 If you print it out, it can look odd and out of place for a human reader. Jiminion In some cases There is a misunderstanding here about operator precedence: If you want to force zeros to be positive, this simple fix should work: Chux has a simpler solution for IEC complying environments: In general, that's true, but in this particular case, you want to check if d is exactly 0.

Just realized this is an old post! There are many significant benefits to preparing forecasts and evaluating NPV even when we know in advance the results will be a zero or negative NPV because the benefits are difficult to quantify. We can still consider different investment alternatives to try to find the least negative NPV solution.

Over a life cycle, this may be a less negative decision, which is better than the more negative decision. Or maybe the smaller scrubber is better. How do we know which will have the least negative NPV without analysis? People are often more willing to say yes or no to a breakeven than they are to submit a forecast of what will happen. We can then use those breakeven assumptions to establish minimum milestones, financial and otherwise, that can be tracked after the investment. For example, consider an investment in technology that will speed up access to information used by many employees every day.

Maybe the breakeven assumption is that employees per day will need to access the information for the project to be financially feasible. Even though this may be a negative NPV, we can track how many people access the data each day and at least see if the expected benefits are happening.

This can be good to know the next time an investment of this type is requested. Or worse, the roof collapses, resulting in litigation. Some companies go to great lengths to make sure they execute strategic investments that appear to have a negative NPV, in some cases deliberately misallocating costs and assets to other projects so the investment looks artificially better.

Getting Rid of Negative Zero Amounts

These cross-subsidies are said to keep a results oriented-organization from terminating strategic initiatives. Unfortunately, this sort of artificial support often endures due to organizational inertia and political posturing, resulting in bad decisions where other truly profitable projects are rejected over time because they are saddled with costs that have been wrongly allocated. Eventually, the misaligned costs and assets are often treated as if they were reality and this can have adverse implications for operational decisions, such as pricing, and strategic decisions, such as how much to invest in growing the subsidized business.

Much better to face the negative NPV, support the initiative anyway, and have clear financial and non-financial milestones that will be signs that the activity should continue to grow into someday having a positive NPV or being shut down. So doing financial analysis on zero and negative NPV investments is as important as doing analysis for positive NPV investments. This will help in evaluating alternatives to find the least negative NPV solution and in setting up minimum milestones that can be used to track performance after the investment.

Your Answer