This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: read float into integer


Paul Thomas wrote:
> Hello Paul,
>
> Long time, no hear!

Indeed.  Work has pulled me over to Python for a bit.

>> pkienzle wrote:
>>   
>>> I don't know if it is a bug, but gfortran does not truncate floating
>>> point
>>> values toward 0 on input.  The f90 code I'm trying to compile assumes
>>> that
>>> it does.
>>
>> This seems to be a very special Intel Fortran Compiler feature as I get:
>>   
> 10.8.1 List-directed input
> Input forms acceptable to edit descriptors for a given type are acceptable
> for list-directed formatting, except as noted below. The form of the input
> value shall be acceptable for the type of the next effective item in the
> list. Blanks are never used as zeros, and embedded blanks are not
> permitted in constants, except within character constants and complex
> constants as specified below.
> When the next effective item is of type integer, the value in the input
> record is interpreted as if an Iw edit descriptor with a suitable value of
> w were used.
>
> So I would say that the ifort behaviour is unexpected, if not a bug.

Looking at the F95 draft standard J3/97-007R2, the ifort behaviour is a bug.
Page 166, line 18:

    In the input field for the I edit descriptor, the character string shall
be a signed-digit-string (R401), except for the interpretation of blanks. 

This text also appears in the 2003 standard J3/04-007.

FWIW, the pgf90 compiler 4.0-2 (2002) behaves in the same way as ifort
10.0-016 (2007).  You've already done all you can in terms of informing the
user, including setting a useful IOMSG string.  Too bad the code I'm using
isn't written to the 2003 standard :-(

Anyway, I'm happy to be able to use F90 code in my project even if it takes
me a little while to resolve the idiosyncrasies of other compilers.  Thank
you all for gfortran!

  - Paul

-- 
View this message in context: http://www.nabble.com/read-float-into-integer-tf4350081.html#a12407930
Sent from the gcc - fortran mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]