SLAU846A June 2023 – October 2023 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1
Signed 32-bit numbers include a signed magnitude component, integer component and fractional component using Q number format. It is expressed as SQm.n, where:
S is the Sign Bit
m is the integer component number of bits
n is the fractional component number of bits
The m and n components vary depending on the operand type. For instance, an operand in SQ15.16 format has the signed number components as shown in Table 5-3.
Description | Value | Number of Bits | Bits |
---|---|---|---|
Sign bit | + or - | S = 1 | 31 |
Integer component | I | m = 15 | 30:16 |
Fractional component | F | n = 16 | 15:0 |
To generate a signed number, such as -1.5 in SQ15.16:
Express the integer component (I = 1) as a number in m bits (0x0001)
Express the fractional component (F = 0.5) as a number in n bits (0x8000)
Express the resulting hexadecimal value as an unsigned value (0x00018000)
If the number is signed, take the 2’s compliment (0xFFFE7FFF)