N
Nobody
I'm trying to understand why this program...
#include <stdio.h>
#include <float.h>
int
main(void)
{
int i = 123456789 ;
int j = 987654321 ;
float k = i ;
float m = j ;
float n ;
float p ;
n = m / 1000000000 ;
p = i + n ;
printf( "%d %d %f %f %f %f %f\n", i, j, k, m, n, k + n, p ) ;
return 0 ;
}
....generates this output:
123456789 987654321 123456792.000000 987654336.000000 0.987654
123456792.987654 123456792.000000
Things confusing me, in order:
1) 123456789 -> 123456792.000000 ? ("...92" ?)
2) 987654321 -> 987654336.000000 ? ("...36" ?)
3) Where'd the .987654 go after storing the addition into p ?
I'm wading through Harbison & Steele currently, but a link or
reference to this specific topic someplace (or an explanation) would
be very helpful.
Suse Linux 8.2, gcc 3.3 20030226 (prerelease)
#include <stdio.h>
#include <float.h>
int
main(void)
{
int i = 123456789 ;
int j = 987654321 ;
float k = i ;
float m = j ;
float n ;
float p ;
n = m / 1000000000 ;
p = i + n ;
printf( "%d %d %f %f %f %f %f\n", i, j, k, m, n, k + n, p ) ;
return 0 ;
}
....generates this output:
123456789 987654321 123456792.000000 987654336.000000 0.987654
123456792.987654 123456792.000000
Things confusing me, in order:
1) 123456789 -> 123456792.000000 ? ("...92" ?)
2) 987654321 -> 987654336.000000 ? ("...36" ?)
3) Where'd the .987654 go after storing the addition into p ?
I'm wading through Harbison & Steele currently, but a link or
reference to this specific topic someplace (or an explanation) would
be very helpful.
Suse Linux 8.2, gcc 3.3 20030226 (prerelease)