Floating point and Fixed point

This post describes Floating point and Fixed point.

IEEE754 32-bit floating point (single precision) is represented by 1-bit sign, 8-bit exponent, and 23-bit mantissa.

Decimal        85.125
Floating point  0x42AA4000
I will not explain the conversion process in this post, but the conversion requires a lot of processing.

Declaring floating point (float) in a program makes the following difference between MCUs with and without FPUs.

FPUProcessing speedCode valuePrice
MCU with FPU (with FPU instruction code)FastSmallHigh
MCU without FPU (without FPU instruction code)SlowLargeLow

Therefore, there are cases where MCUs without FPUs use a fixed decimal 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).

Decimal     85.125
Fixed point  85.125×65536 = 0x00552000

Thus, there are the following differences between floating point and fixed point.

PointStandardCalculationRange of expressionCalculation accuracy
Floating pointStandards.difficultwideHigh
Fixed pointEach company is differenteasynarrowLow

Please note that in the past, MCUs without FPUs were used, so some legacy fixed-point legacy codes may still be present.

OSS-ECAL English
error: Content is protected !!