K
Keith
The bits get twiddled every now and then.
Using gcc 3.2 and 3.4.
To build: cc -o test test.c -lm
---------------- 8< test.c ------------------------
#include <stdio.h>
#include <math.h>
double func(double);
int main() {
int ii ;
double x, r1, r2 ;
x = 2510771730459.374023 ;
for ( ii = 0 ; ii < 100 ; ii++ ) {
r1 = sqrt( 3*x*x ) ;
r2 = sqrt(func(3*x)*x);
if ( r1 != r2 ) {
fprintf(stderr, "\nIteration=%d\n", ii);
fprintf(stderr,"val1=%#llx\n",
*(unsigned long long*)(&r1)) ;
fprintf(stderr,"val2=%#llx\n",
*(unsigned long long*)(&r2)) ;
}
x = r1 ;
}
return 0 ;
}
double func( double temp ) {
return(temp);
}
Using gcc 3.2 and 3.4.
To build: cc -o test test.c -lm
---------------- 8< test.c ------------------------
#include <stdio.h>
#include <math.h>
double func(double);
int main() {
int ii ;
double x, r1, r2 ;
x = 2510771730459.374023 ;
for ( ii = 0 ; ii < 100 ; ii++ ) {
r1 = sqrt( 3*x*x ) ;
r2 = sqrt(func(3*x)*x);
if ( r1 != r2 ) {
fprintf(stderr, "\nIteration=%d\n", ii);
fprintf(stderr,"val1=%#llx\n",
*(unsigned long long*)(&r1)) ;
fprintf(stderr,"val2=%#llx\n",
*(unsigned long long*)(&r2)) ;
}
x = r1 ;
}
return 0 ;
}
double func( double temp ) {
return(temp);
}