From 72ca4af0f99fbce82d143b99649669923b4b1161 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 3 Jul 2019 21:12:59 +0200 Subject: return NaN for wrong poly order argument and handle this error upper in the call stack --- src/main.f90 | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main.f90') 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) -- cgit v1.2.3