This is the mail archive of the newlib@sourceware.cygnus.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: newlib math bug


Stuart Adams wrote:
> 
> I found a problem in the math libraries. Many functions contain the
> following
> fragment:
> 
>      if (exc.err != 0)
>         errno = exc.err;
> 
> However, exc.err is never initialized so you can get very weird errno
> values when an error occurs.
> 

You are correct.  I have included a patch at the end of this reply which
fixes the problem.  Apply the patch in the newlib/libm/math directory.

>
> p.s. Is there a way to get read only access to the newlib CVS root so
>        I can track bug fixes and updates ???

Unfortunately, no, we do not offer access to our current development
sources.

-- Jeff

=============================================================================


Index: w_acos.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_acos.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_acos.c
*** w_acos.c	1997/12/09 19:24:03	1.3
--- w_acos.c	1998/07/22 17:29:14
*************** MATHREF
*** 99,104 ****
--- 99,106 ----
  	    /* acos(|x|>1) */
  	    exc.type = DOMAIN;
  	    exc.name = "acos";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
  	    exc.retval = 0.0;
  	    if (_LIB_VERSION == _POSIX_)
  	       errno = EDOM;
Index: w_acosh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_acosh.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_acosh.c
*** w_acosh.c	1997/12/09 19:24:04	1.3
--- w_acosh.c	1998/07/22 17:29:14
*************** MATHREF
*** 103,108 ****
--- 103,110 ----
              /* acosh(x<1) */
              exc.type = DOMAIN;
              exc.name = "acosh";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
              exc.retval = 0.0/0.0;
              if (_LIB_VERSION == _POSIX_)
                 errno = EDOM;
Index: w_asin.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_asin.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_asin.c
*** w_asin.c	1997/12/09 19:24:05	1.3
--- w_asin.c	1998/07/22 17:29:14
*************** MATHREF  
*** 102,107 ****
--- 102,109 ----
  	    /* asin(|x|>1) */
  	    exc.type = DOMAIN;
  	    exc.name = "asin";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
  	    exc.retval = 0.0;
  	    if(_LIB_VERSION == _POSIX_)
  	      errno = EDOM;
Index: w_atan2.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_atan2.c,v
retrieving revision 1.4
diff -c -p -r1.4 w_atan2.c
*** w_atan2.c	1997/12/09 19:24:07	1.4
--- w_atan2.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 99,104 ****
--- 99,105 ----
  	    exc.arg2 = x;
  	    exc.type = DOMAIN;
  	    exc.name = "atan2";
+ 	    exc.err = 0;
  	    exc.retval = 0.0;
  	    if(_LIB_VERSION == _POSIX_)
  	       errno = EDOM;
Index: w_atanh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_atanh.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_atanh.c
*** w_atanh.c	1997/12/09 19:24:08	1.3
--- w_atanh.c	1998/07/22 17:29:14
*************** QUICKREF
*** 104,109 ****
--- 104,111 ----
                  /* atanh(|x|>1) */
                  exc.type = DOMAIN;
                  exc.name = "atanh";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = x;
                  exc.retval = 0.0/0.0;
                  if (_LIB_VERSION == _POSIX_)
                    errno = EDOM;
*************** QUICKREF
*** 114,119 ****
--- 116,123 ----
                  /* atanh(|x|=1) */
                  exc.type = SING;
                  exc.name = "atanh";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = x;
  		exc.retval = x/0.0;	/* sign(x)*inf */
                  if (_LIB_VERSION == _POSIX_)
                    errno = EDOM;
Index: w_cosh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_cosh.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_cosh.c
*** w_cosh.c	1997/12/09 19:24:10	1.3
--- w_cosh.c	1998/07/22 17:29:14
*************** QUICKREF
*** 94,99 ****
--- 94,101 ----
  #endif
  	    exc.type = OVERFLOW;
  	    exc.name = "cosh";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = HUGE;
  	    else
Index: w_exp.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_exp.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_exp.c
*** w_exp.c	1997/12/09 19:24:11	1.3
--- w_exp.c	1998/07/22 17:29:14
*************** u_threshold= -7.45133219101941108420e+02
*** 98,103 ****
--- 98,105 ----
  #endif
  		exc.type = OVERFLOW;
  		exc.name = "exp";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = x;
  		if (_LIB_VERSION == _SVID_)
  		  exc.retval = HUGE;
  		else
*************** u_threshold= -7.45133219101941108420e+02
*** 114,119 ****
--- 116,123 ----
  		/* exp(finite) underflow */
  		exc.type = UNDERFLOW;
  		exc.name = "exp";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = x;
  		exc.retval = 0.0;
  		if (_LIB_VERSION == _POSIX_)
  		  errno = ERANGE;
Index: w_fmod.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_fmod.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_fmod.c
*** w_fmod.c	1997/12/09 19:24:13	1.3
--- w_fmod.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 84,89 ****
--- 84,92 ----
              /* fmod(x,0) */
              exc.type = DOMAIN;
              exc.name = "fmod";
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = y;
+ 	    exc.err = 0;
              if (_LIB_VERSION == _SVID_)
                 exc.retval = x;
  	    else
Index: w_gamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_gamma.c,v
retrieving revision 1.4
diff -c -p -r1.4 w_gamma.c
*** w_gamma.c	1997/12/09 19:24:14	1.4
--- w_gamma.c	1998/07/22 17:29:14
*************** Neither <<gamma>> nor <<gammaf>> is ANSI
*** 158,163 ****
--- 158,165 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "gamma";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
              if (_LIB_VERSION == _SVID_)
                  exc.retval = HUGE;
              else
Index: w_hypot.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_hypot.c,v
retrieving revision 1.4
diff -c -p -r1.4 w_hypot.c
*** w_hypot.c	1997/12/09 19:24:16	1.4
--- w_hypot.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 86,91 ****
--- 86,94 ----
  #endif
  	    exc.type = OVERFLOW;
  	    exc.name = "hypot";
+ 	    exc.err = 0;
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = y;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = HUGE;
  	    else
Index: w_j0.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_j0.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_j0.c
*** w_j0.c	1997/12/09 19:24:17	1.3
--- w_j0.c	1998/07/22 17:29:14
*************** None of the Bessel functions are in ANSI
*** 144,149 ****
--- 144,151 ----
  	    /* j0(|x|>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "j0";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                 errno = ERANGE;
*************** None of the Bessel functions are in ANSI
*** 182,187 ****
--- 184,191 ----
  	    /* y0(0) = -inf or y0(x<0) = NaN */
  	    exc.type = DOMAIN;	/* should be SING for IEEE y0(0) */
  	    exc.name = "y0";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = -HUGE;
  	    else
*************** None of the Bessel functions are in ANSI
*** 199,204 ****
--- 203,210 ----
  	    /* y0(x>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "y0";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                 errno = ERANGE;
Index: w_j1.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_j1.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_j1.c
*** w_j1.c	1997/12/09 19:24:18	1.3
--- w_j1.c	1998/07/22 17:29:14
***************
*** 38,43 ****
--- 38,45 ----
  	    /* j1(|x|>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "j1";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
***************
*** 76,81 ****
--- 78,85 ----
  	    /* y1(0) = -inf  or y1(x<0) = NaN */
  	    exc.type = DOMAIN;	/* should be SING for IEEE */
  	    exc.name = "y1";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = -HUGE;
  	    else
***************
*** 93,98 ****
--- 97,104 ----
  	    /* y1(x>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "y1";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
Index: w_jn.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_jn.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_jn.c
*** w_jn.c	1997/12/09 19:24:19	1.3
--- w_jn.c	1998/07/22 17:29:14
***************
*** 60,65 ****
--- 60,68 ----
  	    /* jn(|x|>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "jn";
+ 	    exc.err = 0;
+ 	    exc.arg1 = n;
+ 	    exc.arg2 = x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
***************
*** 98,103 ****
--- 101,109 ----
  #endif
  	    exc.type = DOMAIN;	/* should be SING for IEEE */
  	    exc.name = "yn";
+ 	    exc.err = 0;
+ 	    exc.arg1 = n;
+ 	    exc.arg2 = x;
  	    if (_LIB_VERSION == _SVID_)
  	        exc.retval = -HUGE;
  	    else
***************
*** 115,120 ****
--- 121,129 ----
  	    /* yn(x>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "yn";
+ 	    exc.err = 0;
+ 	    exc.arg1 = n;
+ 	    exc.arg2 = x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
Index: w_lgamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_lgamma.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_lgamma.c
*** w_lgamma.c	1997/12/09 19:24:21	1.3
--- w_lgamma.c	1998/07/22 17:29:14
***************
*** 45,50 ****
--- 45,53 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "lgamma";
+ 	    exc.err = 0;
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = x;
              if (_LIB_VERSION == _SVID_)
                 exc.retval = HUGE;
              else
Index: w_log.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_log.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_log.c
*** w_log.c	1997/12/09 19:24:22	1.3
--- w_log.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 82,87 ****
--- 82,90 ----
  	SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	exc.name = "log";
+ 	exc.err = 0;
+ 	exc.arg1 = x;
+ 	exc.arg2 = x;
  	if (_LIB_VERSION == _SVID_)
             exc.retval = -HUGE;
  	else
Index: w_log10.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_log10.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_log10.c
*** w_log10.c	1997/12/09 19:24:23	1.3
--- w_log10.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 80,85 ****
--- 80,88 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "log10";
+ 	    exc.err = 0;
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = x;
  	    if (_LIB_VERSION == _SVID_)
                 exc.retval = -HUGE;
  	    else
Index: w_pow.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_pow.c,v
retrieving revision 1.4
diff -c -p -r1.4 w_pow.c
*** w_pow.c	1997/12/09 19:24:25	1.4
--- w_pow.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 90,95 ****
--- 90,98 ----
  		/* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
  		exc.type = DOMAIN;
  		exc.name = "pow";
+ 		exc.err = 0;
+ 		exc.arg1 = x;
+ 		exc.arg2 = y;
  		exc.retval = x;
  		if (_LIB_VERSION == _IEEE_ ||
  		    _LIB_VERSION == _POSIX_) exc.retval = 1.0;
*************** PORTABILITY
*** 108,113 ****
--- 111,119 ----
  		/* error only if _LIB_VERSION == _SVID_ */
  		exc.type = DOMAIN;
  		exc.name = "pow";
+ 		exc.err = 0;
+ 		exc.arg1 = x;
+ 		exc.arg2 = y;
  		exc.retval = 0.0;
  		if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
  		else if (!matherr(&exc)) {
*************** PORTABILITY
*** 121,126 ****
--- 127,135 ----
  		/* 0**neg */
  		exc.type = DOMAIN;
  		exc.name = "pow";
+ 		exc.err = 0;
+ 		exc.arg1 = x;
+ 		exc.arg2 = y;
  		if (_LIB_VERSION == _SVID_) 
  		  exc.retval = 0.0;
  		else
*************** PORTABILITY
*** 142,147 ****
--- 151,159 ----
  		    /* neg**non-integral */
  		    exc.type = DOMAIN;
  		    exc.name = "pow";
+ 		    exc.err = 0;
+ 		    exc.arg1 = x;
+ 		    exc.arg2 = y;
  		    if (_LIB_VERSION == _SVID_) 
  		        exc.retval = 0.0;
  		    else 
*************** PORTABILITY
*** 158,163 ****
--- 170,178 ----
  		    /* pow(x,y) overflow */
  		    exc.type = OVERFLOW;
  		    exc.name = "pow";
+ 		    exc.err = 0;
+ 		    exc.arg1 = x;
+ 		    exc.arg2 = y;
  		    if (_LIB_VERSION == _SVID_) {
  		       exc.retval = HUGE;
  		       y *= 0.5;
*************** PORTABILITY
*** 182,187 ****
--- 197,205 ----
  	    /* pow(x,y) underflow */
  	    exc.type = UNDERFLOW;
  	    exc.name = "pow";
+ 	    exc.err = 0;
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = y;
  	    exc.retval =  0.0;
  	    if (_LIB_VERSION == _POSIX_)
  	        errno = ERANGE;
Index: w_remainder.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_remainder.c,v
retrieving revision 1.4
diff -c -p -r1.4 w_remainder.c
*** w_remainder.c	1997/12/09 19:24:26	1.4
--- w_remainder.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 82,87 ****
--- 82,90 ----
              /* remainder(x,0) */
              exc.type = DOMAIN;
              exc.name = "remainder";
+ 	    exc.err = 0;
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = y;
              exc.retval = 0.0/0.0;
              if (_LIB_VERSION == _POSIX_)
                 errno = EDOM;
Index: w_scalb.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_scalb.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_scalb.c
*** w_scalb.c	1997/12/09 19:24:27	1.3
--- w_scalb.c	1998/07/22 17:29:14
***************
*** 54,59 ****
--- 54,62 ----
  	    /* scalb overflow; SVID also returns +-HUGE_VAL */
  	    exc.type = OVERFLOW;
  	    exc.name = "scalb";
+ 	    exc.err = 0;
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = fn;
  	    exc.retval = x > 0.0 ? HUGE_VAL : -HUGE_VAL;
  	    if (_LIB_VERSION == _POSIX_)
  	       errno = ERANGE;
***************
*** 68,73 ****
--- 71,79 ----
  	    /* scalb underflow */
  	    exc.type = UNDERFLOW;
  	    exc.name = "scalb";
+ 	    exc.err = 0;
+ 	    exc.arg1 = x;
+ 	    exc.arg2 = fn;
  	    exc.retval = copysign(0.0,x);
  	    if (_LIB_VERSION == _POSIX_)
  	       errno = ERANGE;
Index: w_sinh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_sinh.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_sinh.c
*** w_sinh.c	1997/12/09 19:24:29	1.3
--- w_sinh.c	1998/07/22 17:29:14
*************** QUICKREF
*** 98,103 ****
--- 98,105 ----
  #endif
  	    exc.type = OVERFLOW;
  	    exc.name = "sinh";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = ( (x>0.0) ? HUGE : -HUGE);
  	    else
Index: w_sqrt.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/w_sqrt.c,v
retrieving revision 1.3
diff -c -p -r1.3 w_sqrt.c
*** w_sqrt.c	1997/12/09 19:24:30	1.3
--- w_sqrt.c	1998/07/22 17:29:14
*************** PORTABILITY
*** 71,76 ****
--- 71,78 ----
  	if(x<0.0) {
  	  exc.type = DOMAIN;
  	  exc.name = "sqrt";
+ 	  exc.err = 0;
+ 	  exc.arg1 = exc.arg2 = x;
  	  if (_LIB_VERSION == _SVID_)
  	    exc.retval = 0.0;
            else
Index: wf_acos.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_acos.c,v
retrieving revision 1.4
diff -c -p -r1.4 wf_acos.c
*** wf_acos.c	1997/12/09 19:24:31	1.4
--- wf_acos.c	1998/07/22 17:29:14
***************
*** 38,43 ****
--- 38,45 ----
  	    /* acosf(|x|>1) */
  	    exc.type = DOMAIN;
  	    exc.name = "acosf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
  	    exc.retval = 0.0;
  	    if (_LIB_VERSION == _POSIX_)
  	       errno = EDOM;
Index: wf_acosh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_acosh.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_acosh.c
*** wf_acosh.c	1997/12/09 19:24:32	1.3
--- wf_acosh.c	1998/07/22 17:29:14
***************
*** 39,44 ****
--- 39,46 ----
              /* acoshf(x<1) */
              exc.type = DOMAIN;
              exc.name = "acoshf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              exc.retval = 0.0/0.0;
              if (_LIB_VERSION == _POSIX_)
                 errno = EDOM;
Index: wf_asin.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_asin.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_asin.c
*** wf_asin.c	1997/12/09 19:24:34	1.3
--- wf_asin.c	1998/07/22 17:29:14
***************
*** 40,45 ****
--- 40,47 ----
  	    /* asinf(|x|>1) */
  	    exc.type = DOMAIN;
  	    exc.name = "asinf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
  	    exc.retval = 0.0;
  	    if(_LIB_VERSION == _POSIX_)
  	      errno = EDOM;
Index: wf_atan2.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_atan2.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_atan2.c
*** wf_atan2.c	1997/12/09 19:24:35	1.3
--- wf_atan2.c	1998/07/22 17:29:14
***************
*** 39,44 ****
--- 39,45 ----
  	    /* atan2f(+-0,+-0) */
  	    exc.arg1 = y;
  	    exc.arg2 = x;
+ 	    exc.err = 0;
  	    exc.type = DOMAIN;
  	    exc.name = "atan2f";
  	    exc.retval = 0.0;
Index: wf_atanh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_atanh.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_atanh.c
*** wf_atanh.c	1997/12/09 19:24:37	1.3
--- wf_atanh.c	1998/07/22 17:29:14
***************
*** 39,44 ****
--- 39,46 ----
                  /* atanhf(|x|>1) */
                  exc.type = DOMAIN;
                  exc.name = "atanhf";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = (double)x;
                  exc.retval = 0.0/0.0;
                  if (_LIB_VERSION == _POSIX_)
                    errno = EDOM;
***************
*** 49,54 ****
--- 51,58 ----
                  /* atanhf(|x|=1) */
                  exc.type = SING;
                  exc.name = "atanhf";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = (double)x;
  		exc.retval = x/0.0;	/* sign(x)*inf */
                  if (_LIB_VERSION == _POSIX_)
                    errno = EDOM;
Index: wf_cosh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_cosh.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_cosh.c
*** wf_cosh.c	1997/12/09 19:24:39	1.3
--- wf_cosh.c	1998/07/22 17:29:14
***************
*** 44,49 ****
--- 44,51 ----
  #endif
  	    exc.type = OVERFLOW;
  	    exc.name = "coshf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = HUGE;
  	    else
Index: wf_exp.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_exp.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_exp.c
*** wf_exp.c	1997/12/09 19:24:40	1.3
--- wf_exp.c	1998/07/22 17:29:14
*************** u_threshold= -1.0397208405e+02;  /* 0xc2
*** 53,58 ****
--- 53,60 ----
  #endif
  		exc.type = OVERFLOW;
  		exc.name = "expf";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = (double)x;
  		if (_LIB_VERSION == _SVID_)
  		  exc.retval = HUGE;
  		else
*************** u_threshold= -1.0397208405e+02;  /* 0xc2
*** 69,74 ****
--- 71,78 ----
  		/* expf(finite) underflow */
  		exc.type = UNDERFLOW;
  		exc.name = "expf";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = (double)x;
  		exc.retval = 0.0;
  		if (_LIB_VERSION == _POSIX_)
  		  errno = ERANGE;
Index: wf_fmod.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_fmod.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_fmod.c
*** wf_fmod.c	1997/12/09 19:24:42	1.3
--- wf_fmod.c	1998/07/22 17:29:14
***************
*** 38,43 ****
--- 38,46 ----
              /* fmodf(x,0) */
              exc.type = DOMAIN;
              exc.name = "fmodf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)x;
+ 	    exc.arg2 = (double)y;
              if (_LIB_VERSION == _SVID_)
                 exc.retval = x;
  	    else
Index: wf_gamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_gamma.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_gamma.c
*** wf_gamma.c	1997/12/09 19:24:43	1.3
--- wf_gamma.c	1998/07/22 17:29:14
***************
*** 42,47 ****
--- 42,49 ----
  		/* gammaf(-integer) or gammaf(0) */
  		exc.type = SING;
  		exc.name = "gammaf";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = (double)x;
                  if (_LIB_VERSION == _SVID_)
                    exc.retval = HUGE;
                  else
***************
*** 55,60 ****
--- 57,64 ----
  		/* gammaf(finite) overflow */
  		exc.type = OVERFLOW;
  		exc.name = "gammaf";
+ 		exc.err = 0;
+ 		exc.arg1 = exc.arg2 = (double)x;
                  if (_LIB_VERSION == _SVID_)
                    exc.retval = HUGE;
                  else
Index: wf_hypot.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_hypot.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_hypot.c
*** wf_hypot.c	1997/12/09 19:24:44	1.3
--- wf_hypot.c	1998/07/22 17:29:14
***************
*** 44,49 ****
--- 44,52 ----
  #endif
  	    exc.type = OVERFLOW;
  	    exc.name = "hypotf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)x;
+ 	    exc.arg2 = (double)y;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = HUGE;
  	    else
Index: wf_j0.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_j0.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_j0.c
*** wf_j0.c	1997/12/09 19:24:46	1.3
--- wf_j0.c	1998/07/22 17:29:14
***************
*** 37,42 ****
--- 37,44 ----
  	    /* j0f(|x|>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "j0f";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                 errno = ERANGE;
***************
*** 75,80 ****
--- 77,84 ----
  	    /* y0f(0) = -inf  or y0f(x<0) = NaN */
  	    exc.type = DOMAIN;	/* should be SING for IEEE y0f(0) */
  	    exc.name = "y0f";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = -HUGE;
  	    else
***************
*** 92,97 ****
--- 96,103 ----
  	    /* y0f(x>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "y0f";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
Index: wf_j1.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_j1.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_j1.c
*** wf_j1.c	1997/12/09 19:24:48	1.3
--- wf_j1.c	1998/07/22 17:29:14
***************
*** 39,44 ****
--- 39,46 ----
  	    /* j1f(|x|>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "j1f";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
***************
*** 77,82 ****
--- 79,86 ----
  #endif
  	    exc.type = DOMAIN;	/* should be SING for IEEE */
  	    exc.name = "y1f";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = -HUGE;
  	    else
***************
*** 94,99 ****
--- 98,105 ----
  	    /* y1f(x>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "y1f";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
Index: wf_jn.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_jn.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_jn.c
*** wf_jn.c	1997/12/09 19:24:49	1.3
--- wf_jn.c	1998/07/22 17:29:14
***************
*** 35,40 ****
--- 35,43 ----
  	    /* jnf(|x|>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "jnf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)n;
+ 	    exc.arg2 = (double)x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
***************
*** 73,78 ****
--- 76,84 ----
  #endif
  	    exc.type = DOMAIN;	/* should be SING for IEEE */
  	    exc.name = "ynf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)n;
+ 	    exc.arg2 = (double)x;
  	    if (_LIB_VERSION == _SVID_)
  	        exc.retval = -HUGE;
  	    else
***************
*** 90,95 ****
--- 96,104 ----
  	    /* ynf(x>X_TLOSS) */
              exc.type = TLOSS;
              exc.name = "ynf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)n;
+ 	    exc.arg2 = (double)x;
              exc.retval = 0.0;
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
Index: wf_lgamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_lgamma.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_lgamma.c
*** wf_lgamma.c	1997/12/09 19:24:50	1.3
--- wf_lgamma.c	1998/07/22 17:29:14
***************
*** 39,44 ****
--- 39,46 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "lgammaf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              if (_LIB_VERSION == _SVID_)
                 exc.retval = HUGE;
              else
Index: wf_log.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_log.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_log.c
*** wf_log.c	1997/12/09 19:24:52	1.3
--- wf_log.c	1998/07/22 17:29:14
***************
*** 41,46 ****
--- 41,48 ----
  	SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	exc.name = "logf";
+ 	exc.err = 0;
+ 	exc.arg1 = exc.arg2 = (double)x;
  	if (_LIB_VERSION == _SVID_)
             exc.retval = -HUGE;
  	else
Index: wf_log10.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_log10.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_log10.c
*** wf_log10.c	1997/12/09 19:24:53	1.3
--- wf_log10.c	1998/07/22 17:29:14
***************
*** 42,47 ****
--- 42,49 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "log10f";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
  	    if (_LIB_VERSION == _SVID_)
                 exc.retval = -HUGE;
  	    else
Index: wf_pow.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_pow.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_pow.c
*** wf_pow.c	1997/12/09 19:24:55	1.3
--- wf_pow.c	1998/07/22 17:29:14
***************
*** 40,45 ****
--- 40,48 ----
  		/* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
  		exc.type = DOMAIN;
  		exc.name = "powf";
+ 		exc.err = 0;
+ 		exc.arg1 = (double)x;
+ 		exc.arg2 = (double)y;
  		exc.retval = x;
  		if (_LIB_VERSION == _IEEE_ ||
  		    _LIB_VERSION == _POSIX_) exc.retval = 1.0;
***************
*** 58,63 ****
--- 61,69 ----
  		/* error only if _LIB_VERSION == _SVID_ */
  		exc.type = DOMAIN;
  		exc.name = "powf";
+ 		exc.err = 0;
+ 		exc.arg1 = (double)x;
+ 		exc.arg2 = (double)y;
  		exc.retval = 0.0;
  		if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
  		else if (!matherr(&exc)) {
***************
*** 71,76 ****
--- 77,85 ----
  		/* 0**neg */
  		exc.type = DOMAIN;
  		exc.name = "powf";
+ 		exc.err = 0;
+ 		exc.arg1 = (double)x;
+ 		exc.arg2 = (double)y;
  		if (_LIB_VERSION == _SVID_) 
  		  exc.retval = 0.0;
  		else
***************
*** 92,97 ****
--- 101,109 ----
  		    /* neg**non-integral */
  		    exc.type = DOMAIN;
  		    exc.name = "powf";
+ 		    exc.err = 0;
+ 		    exc.arg1 = (double)x;
+ 		    exc.arg2 = (double)y;
  		    if (_LIB_VERSION == _SVID_) 
  		        exc.retval = 0.0;
  		    else 
***************
*** 108,113 ****
--- 120,128 ----
  		    /* powf(x,y) overflow */
  		    exc.type = OVERFLOW;
  		    exc.name = "powf";
+ 		    exc.err = 0;
+ 		    exc.arg1 = (double)x;
+ 		    exc.arg2 = (double)y;
  		    if (_LIB_VERSION == _SVID_) {
  		       exc.retval = HUGE;
  		       y *= 0.5;
***************
*** 132,137 ****
--- 147,155 ----
  	    /* powf(x,y) underflow */
  	    exc.type = UNDERFLOW;
  	    exc.name = "powf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)x;
+ 	    exc.arg2 = (double)y;
  	    exc.retval =  0.0;
  	    if (_LIB_VERSION == _POSIX_)
  	        errno = ERANGE;
Index: wf_remainder.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_remainder.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_remainder.c
*** wf_remainder.c	1997/12/09 19:24:57	1.3
--- wf_remainder.c	1998/07/22 17:29:14
***************
*** 38,43 ****
--- 38,46 ----
              /* remainderf(x,0) */
              exc.type = DOMAIN;
              exc.name = "remainderf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)x;
+ 	    exc.arg2 = (double)y;
              exc.retval = 0.0/0.0;
              if (_LIB_VERSION == _POSIX_)
                 errno = EDOM;
Index: wf_scalb.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_scalb.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_scalb.c
*** wf_scalb.c	1997/12/09 19:24:59	1.3
--- wf_scalb.c	1998/07/22 17:29:14
***************
*** 54,59 ****
--- 54,62 ----
  	    /* scalbf overflow; SVID also returns +-HUGE_VAL */
  	    exc.type = OVERFLOW;
  	    exc.name = "scalbf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)x;
+ 	    exc.arg2 = (double)fn;
  	    exc.retval = x > 0.0 ? HUGE_VAL : -HUGE_VAL;
  	    if (_LIB_VERSION == _POSIX_)
  	       errno = ERANGE;
***************
*** 68,73 ****
--- 71,79 ----
  	    /* scalbf underflow */
  	    exc.type = UNDERFLOW;
  	    exc.name = "scalbf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = (double)x;
+ 	    exc.arg2 = (double)fn;
  	    exc.retval = copysign(0.0,x);
  	    if (_LIB_VERSION == _POSIX_)
  	       errno = ERANGE;
Index: wf_sinh.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_sinh.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_sinh.c
*** wf_sinh.c	1997/12/09 19:25:00	1.3
--- wf_sinh.c	1998/07/22 17:29:14
***************
*** 44,49 ****
--- 44,51 ----
  #endif
  	    exc.type = OVERFLOW;
  	    exc.name = "sinhf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
  	    if (_LIB_VERSION == _SVID_)
  	       exc.retval = ( (x>0.0) ? HUGE : -HUGE);
  	    else
Index: wf_sqrt.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wf_sqrt.c,v
retrieving revision 1.3
diff -c -p -r1.3 wf_sqrt.c
*** wf_sqrt.c	1997/12/09 19:25:02	1.3
--- wf_sqrt.c	1998/07/22 17:29:14
***************
*** 38,43 ****
--- 38,45 ----
              /* sqrtf(negative) */
              exc.type = DOMAIN;
              exc.name = "sqrtf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              if (_LIB_VERSION == _SVID_)
                exc.retval = 0.0;
              else
Index: wr_gamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wr_gamma.c,v
retrieving revision 1.3
diff -c -p -r1.3 wr_gamma.c
*** wr_gamma.c	1997/12/09 19:25:50	1.3
--- wr_gamma.c	1998/07/22 17:29:14
***************
*** 42,47 ****
--- 42,49 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "gamma";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              if (_LIB_VERSION == _SVID_)
                  exc.retval = HUGE;
              else
Index: wr_lgamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wr_lgamma.c,v
retrieving revision 1.3
diff -c -p -r1.3 wr_lgamma.c
*** wr_lgamma.c	1997/12/09 19:25:56	1.3
--- wr_lgamma.c	1998/07/22 17:29:14
***************
*** 42,47 ****
--- 42,49 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "lgamma";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              if (_LIB_VERSION == _SVID_)
                 exc.retval = HUGE;
              else
Index: wrf_gamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wrf_gamma.c,v
retrieving revision 1.3
diff -c -p -r1.3 wrf_gamma.c
*** wrf_gamma.c	1997/12/09 19:25:57	1.3
--- wrf_gamma.c	1998/07/22 17:29:14
***************
*** 42,47 ****
--- 42,49 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "gammaf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              if (_LIB_VERSION == _SVID_)
                  exc.retval = HUGE;
              else
Index: wrf_lgamma.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libm/math/wrf_lgamma.c,v
retrieving revision 1.3
diff -c -p -r1.3 wrf_lgamma.c
*** wrf_lgamma.c	1997/12/09 19:25:59	1.3
--- wrf_lgamma.c	1998/07/22 17:29:14
***************
*** 42,47 ****
--- 42,49 ----
  	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
  #endif
  	    exc.name = "lgammaf";
+ 	    exc.err = 0;
+ 	    exc.arg1 = exc.arg2 = (double)x;
              if (_LIB_VERSION == _SVID_)
                 exc.retval = HUGE;
              else