public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56026] New: Erroneous behaviour of E and ES format descriptor for large numbers
@ 2013-01-18 10:09 xarthisius.kk at gmail dot com
  2013-01-18 10:45 ` [Bug fortran/56026] " burnus at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: xarthisius.kk at gmail dot com @ 2013-01-18 10:09 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56026
           Summary: Erroneous behaviour of E and ES format descriptor for
                    large numbers
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: xarthisius.kk@gmail.com


For 3 digit exponent 'E' is lost:

$ cat bug.f90 
   print *, HUGE(1.0d0)
   print '(ES18.7)', HUGE(1.0d0)
   print '(E18.10)', HUGE(1.0d0)
   end

$ ./a.out
   1.7976931348623157E+308
   1.7976931+308
   0.1797693135+309


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

* [Bug fortran/56026] Erroneous behaviour of E and ES format descriptor for large numbers
  2013-01-18 10:09 [Bug fortran/56026] New: Erroneous behaviour of E and ES format descriptor for large numbers xarthisius.kk at gmail dot com
@ 2013-01-18 10:45 ` burnus at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-18 10:45 UTC (permalink / raw)
  To: gcc-bugs


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |burnus at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-18 10:45:14 UTC ---
Close as INVALID.


(In reply to comment #0)
> For 3 digit exponent 'E' is lost:
>    print '(ES18.7)', HUGE(1.0d0)
>    print '(E18.10)', HUGE(1.0d0)

Try: E18.10e3


> $ ./a.out
>    1.7976931+308
>    0.1797693135+309

Fortran 2008 has ( http://gcc.gnu.org/wiki/GFortranStandards#Fortran_2008 ):

R1007  data-edit-desc  is  ...
                       or  E w . d [ E e ]
                       or  EN w . d [ E e ]
                       or  ES w . d [ E e ]
                       or  G w [ . d [ E e ] ]
R1011  e  is  int-literal-constant
C1005 (R1011)  e shall be positive.
C1008 (R1007)  For the G edit descriptor, e shall not be speci\fed if w is zero.


How the exponent is handled is stated in "Table 10.1: E and D exponent forms":

   Edit         Absolute        Value Form of
   Descriptor   of Exponent     Exponent(1)
   Ew.d         |exp| <= 99     E±\x06zz or ±\x060zz
                |exp| <= 999    ±zzz
   ...
   (1) where each z is a digit.


Thus, the Fortran standard doesn't allow any other output for your edit
descriptors.


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

end of thread, other threads:[~2013-01-18 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 10:09 [Bug fortran/56026] New: Erroneous behaviour of E and ES format descriptor for large numbers xarthisius.kk at gmail dot com
2013-01-18 10:45 ` [Bug fortran/56026] " burnus 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).