This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problem with math functions (and -O2)
- To: gcc at gcc dot gnu dot org
- Subject: Problem with math functions (and -O2)
- From: Thomas Hiller <thomas dot hiller at sap-ag dot de>
- Date: Tue, 27 Jul 1999 12:48:08 +0200
- Organization: Compaq EMEA BV
The following program works without optimization but not with:
#include <math.h>
#include <errno.h>
#include <string.h>
main() {
double ii = 0.0, jj = 0.0;
errno = 0;
while( errno == 0 ) {
ii = cosh( jj );
printf( "cosh(%+9.4f)=%15g errno=%d %s \n",
jj, ii, errno, strerror(errno));
jj = jj + 1.0;
}
}
What is the problem ?
errno remains 0 even when ii becomes infinity. This happens only with
optimization.
Thanks in advance.
Regards,
Thomas
--
Thomas Hiller
COMPAQ Computer EMEA BV
SAP International Competence Center
LinuxLab