This post describes Floating point and Fixed point.
Floating point
IEEE754 32-bit floating point (single precision) is represented by 1-bit sign, 8-bit exponent, and 23-bit mantissa.
Ex)
Decimal        85.125
Floating point  0x42AA4000
I will not explain the conversion process in this post, but the conversion requires a lot of processing.
Fixed point
I believe that each company uses fixed points with its own set of rules. In this submission, 32-bit fixed-point is expressed as 1-bit sign, 15-bit integer, and 16-bit decimal point (1/65536).
Ex)
Decimal     85.125
Fixed point  85.125×65536 = 0x00552000
FPU (Floating Point Unit)
FPU is a Unit in the Core of the MCU. When you declare floating point (float) in your program, there are the following differences between MCUs with FPU and MCUs without FPU.
| FPU | Processing speed | Code value | Price | 
|---|---|---|---|
| MCU with FPU (with FPU instruction code) | Fast | Small | High | 
| MCU without FPU (without FPU instruction code) | Slow | Large | Low | 
Therefore, there are cases where MCUs without FPUs use a fixed decimal point.
Difference between floating point and fixed minority point
The following differences exist between floating-point and fixed-point systems.
| Point | Standard | Calculation | Range of expression | Calculation accuracy | 
|---|---|---|---|---|
| Floating point | Standards. | difficult | wide | High | 
| Fixed point | Each company is different | easy | narrow | Low | 
Please note that even when using an FPU-equipped MCU, fixed-point code may remain if old legacy code is still present.
Floating Point Caution
When comparing floating-point numbers, please be aware that the results may differ as shown below.
float f = 0.1f * 10U;      /* f = 0.99999994f */
    if( f == 1.0f )
    {
        /* May not meet expectations */
    }For example, the following code may be used for a comparison with 0.0f.
#define iEPSILON            1e-6f                               /* Margin of error */
#define omABS_F(val)        ( (val) < 0.0f ) ? -val )           /* Absolute value */
#define omFLOAT_ZERO(val)   ( omABS_F(val) < iEPSILON ) ? 0.0F  /* Comparison with 0.0f within the margin of error */
