--- ray/src/rt/func.c 1991/06/17 08:51:33 1.17 +++ ray/src/rt/func.c 1991/06/19 15:08:39 1.19 @@ -33,7 +33,7 @@ OBJREC *m; register RAY *r; XF *bx; { - extern double l_arg(); + extern double l_arg(), l_erf(), l_erfc(); extern long eclock; static char *initfile = "rayinit.cal"; static long lastrno = -1; @@ -52,6 +52,8 @@ XF *bx; scompile("Jx=$19;Jy=$20;Jz=$21;", NULL, 0); scompile("Kx=$22;Ky=$23;Kz=$24;", NULL, 0); funset("arg", 1, '=', l_arg); + funset("erf", 1, ':', l_erf); + funset("erfc", 1, ':', l_erfc); setnoisefuncs(); initfile = NULL; } @@ -137,6 +139,24 @@ l_arg() /* return nth real argument */ double +l_erf() /* error function */ +{ + extern double erf(); + + return(erf(argument(1))); +} + + +double +l_erfc() /* cumulative error function */ +{ + extern double erfc(); + + return(erfc(argument(1))); +} + + +double chanvalue(n) /* return channel n to calcomp */ register int n; { @@ -175,8 +195,10 @@ register int n; return(sum * funcxf.sca); } - if (n == 10) /* dot product */ - return(fray->rod); + if (n == 10) /* dot product (range [-1,1]) */ + return( fray->rod <= -1.0 ? -1.0 : + fray->rod >= 1.0 ? 1.0 : + fray->rod ); if (n == 11) /* scale */ return(funcxf.sca);