5 * Revision 1.2 1997/07/01 15:31:41 mclareni
6 * Correction for FP exceptions and restriction of calculations to realistic values, from M. Schroder
8 * Revision 1.1.1.1 1996/04/01 15:01:53 mclareni
12 #include "gen/pilot.h"
13 #if defined(CERNLIB_DOUBLE)
17 DIMENSION P2(0:4),Q2(0:4)
19 PARAMETER(Z1 = 1, HF = Z1/2, C1 = 0.56418 958)
21 C Above the value of VMAX any calculation is pointless. The value is
22 C choosen with a big safety margin - even the double precision
23 C version only returns 1. for V (=ABS(X)) >= 5.9
25 C The value for SWITCH is badly chosen for the single precision
26 C version, which returns 1. already for V >= 3.9
27 PARAMETER(SWITCH = 4.)
29 DATA P10,Q10,P11 /+3.67678 77, +3.25845 93, -9.79704 65E-2/
31 DATA (P2(I),Q2(I),I=0,4)
32 +/+7.37388 83E+0, +7.37396 09E+0, +6.86501 85E+0, +1.51849 08E+1,
33 1 +3.03179 93E+0, +1.27955 30E+1, +5.63169 62E-1, +5.35421 68E+0,
36 DATA P30,Q30,P31 /-1.24368 54E-1, +4.40917 06E-1, -9.68210 36E-2/
47 H=X*(P10+P11*Y)/(Q10+Y)
50 IF(V .LT. SWITCH) THEN
58 ELSEIF ( V .LT. VMAX) THEN
60 HC=EXP(-V**2)*(C1+Y*(P30+P31*Y)/(Q30+Y))/V
62 C for very big values we can save us any calculation, and the
63 C FP-exceptions we would get from EXP.