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: Fortran test cases




On 01/22/2019 08:28 PM, Thomas Koenig wrote:
Hi,

PROGRAM testsin
  real(kind=8) :: pi=3.14159265358979
  real(kind=8) :: out

  out = dsin(pi)
  print *,out
END PROGRAM testsin

Just an additional data point.

If you run this with -Wconversion -Wconversion-extra, you will get

testsin.f90:2:20:

     2 |  real(kind=8) :: pi=3.14159265358979
       |                    1
Warning: Conversion from 'REAL(4)' to 'REAL(8)' at (1) [-Wconversion-extra]
testsin.f90:2:36:

     2 |  real(kind=8) :: pi=3.14159265358979
       |                                    1
Warning: Non-significant digits in 'REAL(4)' number at (1), maybe incorrect KIND [-Wconversion-extra]

so the compiler has a facility to help you detect such errors.

Regards

     Thomas
Thanks.


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