AvrAsmLib/research/float_manip.c

20 lines
346 B
C
Raw Normal View History

2021-01-19 12:28:33 +03:00
// https://rextester.com/l/c_online_compiler_gcc
#include <stdio.h>
int main(void)
{
unsigned char *fc = malloc(4 * sizeof(fc));
*((float*)fc) = 31.19;
fc[3] = 0b00111110;
fc[2] = 0b00100000;
fc[1] = 0b01000000;
fc[0] = 0b00000000;
printf("%f", *((float*)fc));
free(fc);
return 0;
}