Some sources say IEEE754 floats are always stored little-endian but The IEEE754 specification for floating point numbers simply doesn't cover the endianness problem and may vary from machine to machine.
Here is sample code for floating point / byte array conversion:
#include <stdio.h>
int main(int argc, char** argv){
char *a;
float f = 3.14159; // number to start with
a = (char *)&f; // point a to f's location
// print float & byte array as hex
printf("float: %f\n", f);
printf("byte array: %hhX:%hhX:%hhX:%hhX\n", \
a[0], a[1], a[2], a[3]);
// toggle the sign of f -- using the byte array
a[3] = ((unsigned int)a[3]) ^ 128;
//print the numbers again
printf("float: %f\n", f);
printf("byte array: %hhX:%hhX:%hhX:%hhX\n", \
a[0], a[1], a[2], a[3]);
return 0;
}
It's output on a little-indian machine:
float: 3.141590
byte array: D0:F:49:40
float: -3.141590
byte array: D0:F:49:C0
Theoretically, on a big-endian machine the order of bytes would be reversed.
Reference:
http://betterexplained.com/articles/understanding-big-and-little-endian-byte-order/