public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51569] New: documentation on sign intrinsic
@ 2011-12-15 16:11 pascal22p at parois dot net
  2011-12-15 16:29 ` [Bug fortran/51569] " pascal22p at parois dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pascal22p at parois dot net @ 2011-12-15 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51569
           Summary: documentation on sign intrinsic
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pascal22p@parois.net


The documentation of the sign intrinsic is a bit misleading when the B argument
is a signed zero. The explanation in the standard is much more clearer.

Currently it says
(http://gcc.gnu.org/onlinedocs/gcc-4.6.2/gfortran/SIGN.html#SIGN):
"If B\ge 0 then the result is ABS(A), else it is -ABS(A)."

According to the standard -0.0 is greater than zero. Meaning that according to
the documentation I would expect:
sign(1.0,-0.0) = 1.0
which is not true.

I would replace the sentence above by what you can find in the standard:
http://j3-fortran.org/doc/2003_Committee_Draft/ISO_IEC_1539-1.pdf in page 361
(pdf page), 345 (printed page number)


Case (i): If B > 0, the value of the result is |A|.
Case (ii): If B < 0, the value of the result is -|A|.
Case (iii): If B is of type integer and B=0, the value of the result is |A|.
Case (iv): If B is of type real and is zero, then
  (1) If the processor cannot distinguish between positive and negative real
zero,
      the value of the result is |A|.
  (2) If B is positive real zero, the value of the result is |A|.
  (3) If B is negative real zero, the value of the result is -|A|.


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

end of thread, other threads:[~2012-01-15 18:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-15 16:11 [Bug fortran/51569] New: documentation on sign intrinsic pascal22p at parois dot net
2011-12-15 16:29 ` [Bug fortran/51569] " pascal22p at parois dot net
2011-12-29  6:07 ` pinskia at gcc dot gnu.org
2011-12-29 17:59 ` kargl at gcc dot gnu.org
2012-01-15 18:06 ` kargl at gcc dot gnu.org
2012-01-15 18:48 ` kargl 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).