ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/calfunc.c
(Generate patch)

Comparing ray/src/common/calfunc.c (file contents):
Revision 2.23 by greg, Tue Jun 11 22:13:50 2019 UTC vs.
Revision 2.28 by greg, Fri Apr 8 23:32:25 2022 UTC

# Line 150 | Line 150 | funset(                                /* set a library function */
150          if (cp == fname) return;
151      }
152      if ((lp = liblookup(fname)) == NULL) {      /* insert */
153 +        if (fptr == NULL)
154 +                return;                         /* nothing! */
155          if (libsize >= MAXLIB) {
156              eputs("Too many library functons!\n");
157              quit(1);
# Line 356 | Line 358 | libfunc(                               /* execute library function */
358              errno = ERANGE;
359      }
360   #endif
361 <    if (errno == EDOM || errno == ERANGE) {
361 >    if ((errno == EDOM) | (errno == ERANGE)) {
362          wputs(fname);
363          if (errno == EDOM)
364                  wputs(": domain error\n");
# Line 394 | Line 396 | l_select(char *nm)     /* return argument #(A1+1) */
396          double  a1 = argument(1);
397          int  n = (int)(a1 + .5);
398  
399 <        if (a1 < -.5 || n >= narg) {
399 >        if ((a1 < -.5) | (n >= narg)) {
400                  errno = EDOM;
401                  return(0.0);
402          }
# Line 408 | Line 410 | static double
410   l_max(char *nm)         /* general maximum function */
411   {
412          int  n = nargum();
413 <        int  i = 1;
412 <        int  vmax = argument(1);
413 >        double  vmax = argument(1);
414  
415 <        while (i++ < n) {
416 <                double  v = argument(i);
415 >        while (n > 1) {
416 >                double  v = argument(n--);
417                  if (vmax < v)
418                          vmax = v;
419          }
# Line 424 | Line 425 | static double
425   l_min(char *nm)         /* general minimum function */
426   {
427          int  n = nargum();
428 <        int  i = 1;
428 <        int  vmin = argument(1);
428 >        double  vmin = argument(1);
429  
430 <        while (i++ < n) {
431 <                double  v = argument(i);
430 >        while (n > 1) {
431 >                double  v = argument(n--);
432                  if (vmin > v)
433                          vmin = v;
434          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines