Subject: Re: fdlibm based math library has been integrated
To: None <conklin@kaleida.com>
From: Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>
List: current-users
Date: 02/12/1994 21:40:10
The new math library is missing some entry points that were in the old one:
drem, cabs and z_abs.  IMHO z_abs was only there for the Fortran compiler.
Also there are some functions (fabs, frexp, isnan, ldex and modf) that
are already in the c library.  Below are some patches to add back cabs
and drem and remove the functions that are already in libc.

*** include/math.h-	Sat Feb 12 11:10:11 1994
--- include/math.h	Sat Feb 12 21:27:47 1994
***************
*** 125,130 ****
--- 125,131 ----
  extern double fmod __P((double, double));
  
  #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+ extern double cabs();	/* we can't describe cabs()'s argument properly */
  extern double erf __P((double));
  extern double erfc __P((double));
  extern double gamma __P((double));
***************
*** 145,150 ****
--- 146,152 ----
  extern double asinh __P((double));
  extern double atanh __P((double));
  extern double cbrt __P((double));
+ extern double drem __P((double, double));
  extern double logb __P((double));
  extern double nextafter __P((double, double));
  extern double remainder __P((double, double));
*** lib/libm/Makefile-	Sat Feb 12 11:12:16 1994
--- lib/libm/Makefile	Sat Feb 12 21:21:12 1994
***************
*** 68,78 ****
  	w_log.o w_log10.o w_pow.o w_remainder.o \
  	w_scalb.o w_sinh.o w_sqrt.o \
  	s_asinh.o s_atan.o s_cbrt.o s_ceil.o s_copysign.o \
! 	s_cos.o s_erf.o s_expm1.o s_fabs.o s_finite.o s_floor.o \
! 	s_frexp.o s_ilogb.o s_isnan.o s_ldexp.o s_lib_version.o \
! 	s_log1p.o s_logb.o s_matherr.o s_modf.o s_nextafter.o \
  	s_rint.o s_scalbn.o s_signgam.o s_significand.o s_sin.o \
  	s_tan.o s_tanh.o
  
  
  MAN3+=	acos.0 acosh.0 asin.0 asinh.0 atan.0 atan2.0 atanh.0 ceil.0 \
--- 68,80 ----
  	w_log.o w_log10.o w_pow.o w_remainder.o \
  	w_scalb.o w_sinh.o w_sqrt.o \
  	s_asinh.o s_atan.o s_cbrt.o s_ceil.o s_copysign.o \
! 	s_cos.o s_erf.o s_expm1.o s_finite.o s_floor.o \
! 	s_ilogb.o s_lib_version.o \
! 	s_log1p.o s_logb.o s_matherr.o s_nextafter.o \
  	s_rint.o s_scalbn.o s_signgam.o s_significand.o s_sin.o \
  	s_tan.o s_tanh.o
+ #	s_fabs.o s_frexp.o s_isnan.o s_ldexp.o s_modf.o
+ # The uncommented files/functions above are already in libc
  
  
  MAN3+=	acos.0 acosh.0 asin.0 asinh.0 atan.0 atan2.0 atanh.0 ceil.0 \
*** lib/libm/src/fdlibm.h-	Fri Feb 11 18:52:18 1994
--- lib/libm/src/fdlibm.h	Sat Feb 12 21:28:13 1994
***************
*** 143,148 ****
--- 143,150 ----
  /*
   * BSD math library entry points
   */
+ extern double cabs();	/* we can't describe cabs()'s argument properly */
+ extern double drem __P((double, double));
  extern double expm1 __P((double));
  extern double log1p __P((double));
  
*** lib/libm/src/w_hypot.c-	Fri Feb 11 19:10:02 1994
--- lib/libm/src/w_hypot.c	Sat Feb 12 20:58:21 1994
***************
*** 12,18 ****
   */
  
  /*
!  * wrapper hypot(x,y)
   */
  
  #include <math.h>
--- 12,18 ----
   */
  
  /*
!  * wrappers hypot(x,y) and BSD cabs(z)
   */
  
  #include <math.h>
***************
*** 36,39 ****
--- 36,53 ----
  	else
  	    return z;
  #endif
+ }
+ 
+ struct complex {
+ 	double x, y;
+ };
+ 
+ #ifdef __STDC__
+ 	double cabs(struct complex z)	/* wrapper cabs */
+ #else
+ 	double cabs(z)			/* wrapper cabs */
+ 	struct complex z;
+ #endif
+ {
+ 	return hypot(z.x,z.y);
  }
*** lib/libm/src/w_remainder.c-	Fri Feb 11 19:10:13 1994
--- lib/libm/src/w_remainder.c	Sat Feb 12 20:58:32 1994
***************
*** 12,18 ****
   */
  
  /* 
!  * wrapper remainder(x,p)
   */
  
  #include <math.h>
--- 12,18 ----
   */
  
  /* 
!  * wrappers remainder(x,p) and BSD drem(x,p)
   */
  
  #include <math.h>
***************
*** 35,38 ****
--- 35,48 ----
  	else
  	    return z;
  #endif
+ }
+ 
+ #ifdef __STDC__
+ 	double drem(double x, double y)		/* wrapper drem */
+ #else
+ 	double drem(x,y)			/* wrapper drem */
+ 	double x,y;
+ #endif
+ {
+ 	return remainder(x,y);
  }

-- 
/  Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>  \            Moo!  (__)
| Center for Complex Systems and Visualization (CeVis) |_________/--------(oo)
|     University of Bremen, FB 3, Bibliothekstr. 1     |        * |______||\/
\_o_ D-28359 Bremen, Germany, FAX: +49 421 218-4236 _o_/          ^^     ^^

------------------------------------------------------------------------------