Fixed-point

From Wexos's Wiki
Jump to navigationJump to search

In computing, a fixed-point value is a real number, represented as an integer value. The name refers to that that the radix point is fixed. Fixed-point values are commonly used on older processors and microcontrollers, before floating-point values were used, but can also be used on modern ones, incase of performance or cost restrictions. Fixed-point values are usually represented in base 2 or base 10, but can theoretically be represented in any base.

Base 10

In base 10, an integer scale value, which is a power of 10, is used to encode and decode the fixed-point, usually. The exponent of the scale value specifies where the index of the radix point. For example, 53.98 can be represented as 5398 (scale 100) and 0.553 can be represented as 553 (scale 1000).

Base 2

Base 2 works the same as base 10, an integer scale value is used. For example, 5.5 can be represented as 176 (scale 32). The scale value works the same as for base 10, meaning the exponent of the scale value represents the radix point index.

External Links