This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Fortran test cases
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: Benson Muite <benson_muite at emailplus dot org>, fortran at gcc dot gnu dot org
- Date: Tue, 22 Jan 2019 19:28:14 +0100
- Subject: Re: Fortran test cases
- References: <597f4291-e108-8591-550d-e69da7a53d38@emailplus.org>
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