Date: Mon, 2 Nov 92 22:22:36 EST From: ronis AT ronis DOT chem DOT mcgill DOT ca (David Ronis) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Problem with tanh in version 1.09 Hi DJ, I'm in the process of bringing over and unpacking version 1.09 of djgpp. While doing this, I decided to have a look at some of the sources that were changed, and in particular, at those I've looked at in the past. One of the first ones I examined is incorrect; specifically, libsr/m/src/tanh.c. Your code reads: #include double tanh(double x) { const double ebig = exp(fabs(x)); const double esmall = 1.0/ebig; return (ebig - esmall) / (ebig + esmall); } This makes tanh(x) an even function of x. It should be odd. The problem can be removed by getting rid of the fabs(x), or you can do something like you've done in the sinh function; e.g., #include double tanh(double x) { if(x>=0.0){ const double epos=exp(x); return (epos-1.0/epos)/2.0; } else { const double eneg=exp(-x); return (1.0/eneg-eneg)/2.0; } } In addition, I noticed that in asinh.c you do a test x>0, where x is a double. This is probably picky, but shouldn't it be x>0.0? Does it matter? David Ronis