octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #37882] printf('%4d', -0) prints 0


From: Rik
Subject: [Octave-bug-tracker] [bug #37882] printf('%4d', -0) prints 0
Date: Wed, 27 Feb 2013 15:59:11 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0

Update of bug #37882 (project octave):

                  Status:                    None => Need Info              

    _______________________________________________________

Follow-up Comment #2:

I think this is actually the expected behavior.

The IEEE floating point standard store numbers in a format with a signbit,
mantissa, and exponent.  It is therefore possible to have a mantissa of 0 and
the signbit either set or unset which leads to -/+ 0.

When you call 'printf ("%4d", -0)' you are asking the printf routine to
convert a floating point number to an integer format.  The integers are stored
using two's complement format and there is only a single possible zero for the
integers which is +0.

If you agree that this is correct I will close this bug.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37882>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]