I am trying to understand how floating point numbers are represented on thingy 53, using the code below.
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "stdint.h"
#include "stdio.h"
typedef union variable_t
{
float val_float;
uint32_t val_uint32;
}variable;
#define MAIN_LOG_MODULE_NAME app
LOG_MODULE_REGISTER(MAIN_LOG_MODULE_NAME);
#define SLEEP_INTERVAL_MS 1000
int main(void)
{
variable a_variable;
a_variable.val_float = 2.25f;
When I look at the console here is the output:
My first question is why can't I see the float value?
Second and main question, how is the floating point value encoded.
If I look at the binary representation of the decimal value I calculate it to be:
0100 0000 0001 0000 0000 0000 0000 0000
I would expect to see 1001 somewhere in order to display the value 2.25?