aboutsummaryrefslogtreecommitdiff
path: root/src/main.f90
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-07-03 21:12:59 +0200
committerWojtek Kosior <kwojtus@protonmail.com>2019-07-03 21:12:59 +0200
commit72ca4af0f99fbce82d143b99649669923b4b1161 (patch)
treedd2aa7470cca1f2a7c292fa3aaaa0a5594631487 /src/main.f90
parent7b91f51a0de4ce6077e66c37d673e541762476d6 (diff)
downloadfortran-assignment3-72ca4af0f99fbce82d143b99649669923b4b1161.tar.gz
fortran-assignment3-72ca4af0f99fbce82d143b99649669923b4b1161.zip
return NaN for wrong poly order argument and handle this error upper in the call stack
Diffstat (limited to 'src/main.f90')
-rw-r--r--src/main.f907
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.f90 b/src/main.f90
index c0ecd48..e49603e 100644
--- a/src/main.f90
+++ b/src/main.f90
@@ -29,6 +29,7 @@ PROGRAM integrator
USE quadratures
USE functions
USE iso_fortran_env, ONLY: error_unit
+ USE, intrinsic :: ieee_arithmetic
IMPLICIT none
real(kind=8) :: ibeg, iend, val
@@ -112,6 +113,12 @@ PROGRAM integrator
val = numerical_int(ibeg, iend, fun, poly_order)
+ IF (ieee_is_nan(val)) THEN
+ errmsg = "invalid 5th argument (polynomial order)"
+ isok = .false.
+ GOTO 1
+ END IF
+
if (this_image() == 1) write (*,*) val
1 if (this_image() == 1 .and. .not. isok) write(*,*) trim(errmsg)