Floating point puzzle

Joe Keane jgk at speech2.cs.cmu.edu
Mon Aug 8 08:59:26 AEST 1988


In article <3117 at emory.uucp> riddle at emory.uucp (Larry Riddle) writes:
>However, my experiments seem to imply that floats have an 11
>bit biased exponent (offset by 1023) and only a 20 bit normalized
>mantissa, exactly the same as doubles, except double has a 52 bit
>mantissa.

(This belongs on comp.lang.c!)  The problem is, a float parameter gets
converted to double.  So you're looking at the first 32 bits of the
double representation.  To look at the float representation, use this:
	printf("x: %lx", * (long *) &x);

--Joe



More information about the Comp.lang.c mailing list