Hello,
I am a QNX 4.25 user, December 1999 CD. I have a paid support
contract–I don’t know how to indicate that using the QDN as opposed
to QUICs.
On this nifty little C program:
#include <stdio.h>
#include <stdlib.h>
double interval, aa;
int cnt;
main()
{
for(cnt = 0; cnt < 10000; cnt++)
aa = sin(3.1416 * 10.0 / 180.0);
interval = 0.833276;
printf(“Value: %f\n”, interval);
printf(“Value: %f\n”, interval);
exit(EXIT_SUCCESS);
}
the output will be:
Value: 1.000000
Value: 0.833276
This looks like a bug to me. Has it been covered before?
I stumbled on this because I forgot to #include <math.h>, and if I do
so, the bug goes away. It seems that the floating point system is
somehow screwed up doing the sin operation when the system thinks the
sin is integer instead of double.
I would imagine the sin is returning a double in the registers and C
is doing a float convertion (thinking an int was returned) and then
storing the result in aa. I don’t understand how this would effect
the printf.
Thanks,
Greg Laird