Mercurial > octave-nkf
diff libcruft/slatec-fn/derfc.f @ 14392:d17237256856
Make SLATEC-FN atanh/erfc functions more tolerant about edge cases like
numerical underflow or NaN values.
* slatec-fn/atanh,f (ATANH): Returns infinity for +-1 and NaN for >1
* slatec-fn/datanh.f (DATANH): Likewise.
* slatec-fn/erfc.f (ERFC): Returns NaN for Nan input.
* slatec-fn/derfc.f (DERFC): Likewise.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Thu, 23 Feb 2012 09:12:47 +0000 |
parents | 30c606bec7a8 |
children |
line wrap: on
line diff
--- a/libcruft/slatec-fn/derfc.f Wed Feb 22 20:06:05 2012 -0500 +++ b/libcruft/slatec-fn/derfc.f Thu Feb 23 09:12:47 2012 +0000 @@ -191,6 +191,11 @@ ENDIF FIRST = .FALSE. C + IF (ISNAN(X)) THEN + DERFC = X + RETURN + ENDIF +C IF (X.GT.XSML) GO TO 20 C C ERFC(X) = 1.0 - ERF(X) FOR X .LT. XSML @@ -219,8 +224,7 @@ IF (X.LT.0.D0) DERFC = 2.0D0 - DERFC RETURN C - 40 CALL XERMSG ('SLATEC', 'DERFC', 'X SO BIG ERFC UNDERFLOWS', 1, 1) - DERFC = 0.D0 + 40 DERFC = 0.D0 RETURN C END