J
Jason Sewall
Hello,
I'm using the intel C++ 8.0 compiler on windows and I'm working on some
software that uses the following lines of code:
gf->invdim = 1.0/(double)dim;
printf("invdim: %f\n", (float)gf->invdim);
dim is an integer, gf->invdim a double. I always get "-1.#IND00" as the
output of this code, no matter the value of dim, but only at certain
stages in the code.
If I duplicate the code like so:
gf->invdim = 1.0/(double)dim;
printf("invdim: %f\n", (float)gf->invdim);
gf->invdim = 1.0/(double)dim;
printf("invdim: %f\n", (float)gf->invdim);
The first output is the NAN but the second is the expected result.
I thought I understood C pretty well, but this is weirding me out.
I realize that this is grossly out of context but the program is pretty
complicated and I don't think it would help understand this anyway.
If anyone here has an insight, I'd be much obliged.
Jason Sewall
I'm using the intel C++ 8.0 compiler on windows and I'm working on some
software that uses the following lines of code:
gf->invdim = 1.0/(double)dim;
printf("invdim: %f\n", (float)gf->invdim);
dim is an integer, gf->invdim a double. I always get "-1.#IND00" as the
output of this code, no matter the value of dim, but only at certain
stages in the code.
If I duplicate the code like so:
gf->invdim = 1.0/(double)dim;
printf("invdim: %f\n", (float)gf->invdim);
gf->invdim = 1.0/(double)dim;
printf("invdim: %f\n", (float)gf->invdim);
The first output is the NAN but the second is the expected result.
I thought I understood C pretty well, but this is weirding me out.
I realize that this is grossly out of context but the program is pretty
complicated and I don't think it would help understand this anyway.
If anyone here has an insight, I'd be much obliged.
Jason Sewall