[Bug c/14621] libm tan failure for pi/2 argument

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Wed Mar 17 20:36:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-03-17 20:36 -------
If anything, then this is a bug in the math libs, not the compiler. 
With this program 
------------- 
#include <math.h> 
#include <stdio.h> 
#include <errno.h> 
int main () 
{ 
  printf ("%f\n", tan(M_PI_2)); 
  printf ("%d\n", errno); 
} 
------------- 
I get this output: 
g/x> gcc x.c -lm 
g/x> ./a.out  
16331778728383844.000000 
0 
 
The output of tan(pi/2) is clearly very large, and given the fact that 
(provable) pi/2 is not representable as a floating point number, this 
is not surprising. In particular, it would be wrong to return INF then. 
 
That errno==0 is also not very surprising, since the man pages don't 
say that it should be set. 
 
Thus, this report is clearly invalid. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14621



More information about the Gcc-bugs mailing list