bugGNU Octave - Bugs: bug #49633, display of "minus zero"?

 
 

bug #49633: display of "minus zero"?

Submitted by:  Hartmut <hardy>
Submitted on:  Thu 17 Nov 2016 06:22:44 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: InvalidAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.0.0Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 18 Nov 2016 07:47:57 AM UTC, comment #4:

It's not a bug, it's a feature!

"minus zero" is defined in IEEE 754
https://en.wikipedia.org/wiki/Signed_zero

Example:
1 / 0 = Inf
1 / -0 = -Inf

Armin Müller <arm_in>
Thu 17 Nov 2016 07:13:31 PM UTC, comment #3:

Maybe we should have an option to suppress the negative sign when displaying -0, enabled by default with the --maximum-braindamage option.

John W. Eaton <jwe>
Project Administrator
Thu 17 Nov 2016 06:55:43 PM UTC, comment #2:

Sorry for being too fast with opening a bug report.

I have now also found this: http://stackoverflow.com/questions/2109755/why-does-gnu-octave-have-negative-zeroes

So the "minus zero" seems to be really useful for certain calculations. But why does Octave choose to also display it as an end result? Matlab seems to display it as a zero without a minus sign, when I understand the above post correctly. And I personally was confused because I've never seen any "-0" in Matlab so far.

Just wandering... I'm fine with keeping it this way as well. But it is (slightly) Matlab incompatible.

Hartmut <hardy>
Thu 17 Nov 2016 06:47:29 PM UTC, comment #1:

Because it is not the same as positive zero.

It may be equal to positive zero using the == operator, but it is not the same value in binary floating point representation.

Asking about things like this seems better suited for the help mailing list rather than a bug report.

Mike Miller <mtmiller>
Project Administrator
Thu 17 Nov 2016 06:22:44 PM UTC, original submission:

Why does Octave display "minus zero", even if it is the same as "zero"?

Should this be this way? Or should octave skip the display of the minus sign when the absolute value is zero? Octave obviously already knows that -0==0.

Hartmut <hardy>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by arm_in (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by hardy (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 17 Nov 2016 06:47:29 PM UTCmtmillerOpen/ClosedOpen=>Closed
    Thu 17 Nov 2016 06:47:28 PM UTCmtmillerStatusNone=>Invalid

    Back to the top


    Powered by Savane 3.1-cleanup1