Using NINT instead of INT might get you what you expected (nearest integer instead of truncation)
-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of robin
Sent: Tuesday, March 13, 2012 9:43 PM
To: [log in to unmask]
Subject: Re: Why does this happen?
From: "Cyber Joy" <[log in to unmask]>
Sent: Wednesday, 14 March 2012 12:00 PM
> Dear all,
>
> Actually,I could not understand why I get 12 from the third 'write' clause.
>
> In my opinion,the result of int(4.8d0/0.4d0) may be 12.
Or it may not be.
> So the output of the the third "write(*,*) int(4.8d0/0.4d0)+1" may be 13.
Or it may not be.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 6278 (20110708) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
|