Hi,
The demo program:
/****/
/* try.c */
#include <stdio.h>
#include <math.h>
int main(void) {
int x = -1074;
printf("%e\n", pow (2.0, (double)x));
printf("%e\n", pow (2.0, x));
return 0;
}
/****/
If I build that program (using g++ version 7.3.0) with "g++ -ansi -o try
try.c" I get output of:
4.940656e-324
0.000000e+000
whereas I expected output to be:
4.940656e-324
4.940656e-324
I guess that means that either my expectation is buggy, or something else is
buggy.
Note 1:
If the "-ansi" switch is omitted, then the output matches my expectation.
Note 2:
If cmath is #included instead of math.h, then the output matches my
expectation.
Note 3:
I believe (unproven) that if I use version 5.x.x (or earlier) of g++ then
the output matches my expectation - otherwise it produces the unexpected
output.
In a nutshell, I'm just trying to ascertain whether or not I should submit a
bugzilla report about this.
Cheers,
Rob