Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

noko

Name: noko 2011-11-12 3:08

Is there any alternative means (besides those similar to the one depicted) to assign the binary/hexadecimal value of a float?

http://images.4chan.org/g/src/1321083834256.png


#include <stdio.h>

int main(void) {
    float pi;
    char *testPi;
    testPi = (char *)&pi;

    testPi[3] = 0x40;
    testPi[2] = 0x49;
    testPi[1] = 0x0F;
    testPi[0] = 0xDB;

    printf("%3.80f\n", pi);
   
    return 0;
}

Name: Anonymous 2011-11-12 4:05

>>4
My posts constitute 33% of /prog/ by now.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List