public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/49188] New: Mismatch between -fsign-zero documentation and formatted output
@ 2011-05-27 10:54 thenlich at users dot sourceforge.net
  2011-05-27 12:36 ` [Bug libfortran/49188] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-05-27 10:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49188

           Summary: Mismatch between -fsign-zero documentation and
                    formatted output
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


The documentation of the -fsign-zero option mentions "floating point numbers of
value zero with the sign bit set":

"When enabled, floating point numbers of value zero with the sign bit set are
written as negative number in formatted output and treated as negative in the
SIGN intrinsic. fno-sign-zero does not print the negative sign of zero values
and regards zero as positive number in the SIGN intrinsic for compatibility
with F77. Default behavior is to show the negative sign."

However the flag also affects the output of numbers with a value other than
zero, which have their non-zero digits truncated due to formatting.

E.g.:
    print "(rc,f4.1)", -0.04
-fsign-zero:
-0.0
-fno-sign-zero:
 0.0

This fno-sign-zero behaviour is not according to the Fortran standard ("a minus
sign if the internal value is negative") including F77 which is explicitly
mentioned in the documentation. (Or is this referring to a specific, possibly
non-Fortran77-compliant compiler named F77?)

The only sense this would make is if this option would be restricted to
actually do what it says in the documentation, regarding a zero with the sign
bit set as a mathematical zero, a non-negative value.

In my opinion the formatting routines for real numbers should be changed to
only affect zero values.

Additionally, the last sentence ("Default behavior is to show the negative
sign.") should be made more precise (e.g. "The option is enabled by default")
to reflect that the SIGN intrinsic is also affected by the default setting.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-07 22:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 10:54 [Bug libfortran/49188] New: Mismatch between -fsign-zero documentation and formatted output thenlich at users dot sourceforge.net
2011-05-27 12:36 ` [Bug libfortran/49188] " burnus at gcc dot gnu.org
2011-05-27 18:46 ` thenlich at users dot sourceforge.net
2011-11-07 22:26 ` fxcoudert at gcc dot gnu.org
2011-11-07 22:33 ` fxcoudert at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).