F
Frank
Consult gcc's documentation:
Thx, Keith, I wouldn't have found that in a million years. What is
the newsgroup that deals with gcc-specific stuff?
* `The default state for the `FENV_ACCESS' pragma (C99 7.6.1).'
This pragma is not implemented, but the default is to "off" unless
`-frounding-math' is used in which case it is "on".
For whatever I tested with, it made no difference in the output
whether that flag was included.
gcc does not fully conform to C99.
What's more, it doesn't support annex f completely, which is, of
course, their prerogative. I've been dinking around with this:
F:\gfortran\dan>gcc iec3.c -Wall -Wextra -o iec.exe
F:\gfortran\dan>iec
-1.#IND00 1.#QNAN0 -1.#IND00 -1.#IND00
1.#INF00 1.#INF00 1.#INF00
1100000000000000100000000000000000000000000000000000000000000000000000000000.000
000
1.#INF00
-0.000000
erfc is 2.000000
tgamma is 1.#INF00
tgamma is 1.#INF00
F:\gfortran\dan>type iec3.c
#include <stdio.h>
#include <fenv.h>
#include <math.h>
int main(void)
{
float f[] = { 0.0/0.0 }; // raises an exception
static float x = 0.0/0.0; // does not raise an exception
float y = 0.0/0.0; // raises an exception
double z = 0.0/0.0; // raises an exception
printf("%f %f %f %f\n",f[0], x, y ,z);
float u[] = { 1.1e75 }; // raises exceptions
static float v = 1.1e75; // does not raise exceptions
float w = 1.1e75; // raises exceptions
double a = 1.1e75; // may raise exceptions
float b = 1.1e75f; // may raise exceptions
long double c = 1.1e75; // does not raise exceptions
printf("%f %f %f \n%f \n %f \n %Lf\n", u[0],v,w,a,b,c);
float g = erfc(-u[0]);
printf("erfc is %f\n", g);
float h = tgamma(0.0);
printf("tgamma is %f\n", h);
h = tgamma(-3);
printf("tgamma is %f\n", h);
return 0;
}
// gcc iec3.c -Wall -Wextra -o iec.exe
F:\gfortran\dan>
This shows that the static storage class specifier doesn't make a
difference in not raising an exception. I would have expected
differing exceptions for the tgamma's.
However, erfc(-¥) returns 2.