: function f(float z)
: which returns an unsigned number having the same bit representation
: as its floating-point argument.????
: any answer???
Ah, the dangerous beauty of C is that this sort of thing is easy.
For example:
float fAlpha = 3.14159;
unsigned long ulAlphaBits = *(unsigned long *)(&fAlpha);
which on my current architecture places 0xD00F4940 into ulAlphaBits.
This takes the pointer to the float of interest, casts it into a pointer to an int, and then dereferences it for the copy as an int.
Use with caution though, since the answer will change if you go to
a different architecture, so portability is low.
-Dan