- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Given the program (tinpconerr.for):
CHARACTER S*13
REAL RVALUE
S = '1.7014119D+38'
READ(S(1:13),'(G15.0)',IOSTAT=IOS) RVALUE
WRITE(*,'(I5,5X,G25.16)') IOS,RVALUE
END
Compiled, linked and run:
$ for tinpconerr
$ link tinpconerr
$ run tinpconerr
64 0.1701411733192644E+39
Result is close to greatest real but manual says it should be 0. According to the documentation:
Run_Time_Messages
INPCONERR
NUMBER: 64
ERROR CODE: F
MESSAGE TEXT: input conversion error
EXPLANATION: During a formatted input operation, an invalid
character was detected in an input field, or the input value
overflowed the range representable in the input variable.
The value of the variable was set to zero.
is the manual in error? or is something wrong with this program?
Willem Grooters
CHARACTER S*13
REAL RVALUE
S = '1.7014119D+38'
READ(S(1:13),'(G15.0)',IOSTAT=IOS) RVALUE
WRITE(*,'(I5,5X,G25.16)') IOS,RVALUE
END
Compiled, linked and run:
$ for tinpconerr
$ link tinpconerr
$ run tinpconerr
64 0.1701411733192644E+39
Result is close to greatest real but manual says it should be 0. According to the documentation:
Run_Time_Messages
INPCONERR
NUMBER: 64
ERROR CODE: F
MESSAGE TEXT: input conversion error
EXPLANATION: During a formatted input operation, an invalid
character was detected in an input field, or the input value
overflowed the range representable in the input variable.
The value of the variable was set to zero.
is the manual in error? or is something wrong with this program?
Willem Grooters
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get, with your code, 0 and 0.1701411834604692E+39 (CVF 6.1a, W2K, Pentium II) AND you should declare RVALUE as REAL(8), not REAL. Then I get 0 and 0.1701411000000000E+39.
Any 64!
Regards,
Sabalan.
Any 64!
Regards,
Sabalan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can reproduce the behavior on VMS.
The Fortran standard says that the values of all variables in the I/O list of a READ become undefined if an error condition occurs. I'm not sure why the manual says the value is set to zero - we'll look at that. My view, offhand, is that the documentation is wrong.
Steve
The Fortran standard says that the values of all variables in the I/O list of a READ become undefined if an error condition occurs. I'm not sure why the manual says the value is set to zero - we'll look at that. My view, offhand, is that the documentation is wrong.
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page