Page 260 - ARM 64 Bit Assembly Language
P. 260

Non-integral mathematics 249

                                                     0
                                        4
                                                 1
                                            2
                                   = 2 + 2 + 2 + 2 + 2    −4  + 2 −6  + 2 −8  + 2 −9
                                                       1    1     1     1
                                   = 16 + 4 + 2 + 1 +    +     +     +
                                                       16   64   256   512
                                   = 23.083984375 10
                     Likewise, the following figure shows a signed fixed point number with nine bits in the integer
                     part and six bits in the fractional part. It is as S(9,6) number. Note that the total number of
                     bits is 9 + 6 + 1 = 16.















                     The value of this number in base 10 can be computed by summing the values of each non-
                     zero bit as follows:

                                       2 13−6  + 2 11−6  + 2 10−6  + 2 9−6  + 2 5−6  + 2 3−6  + 2 1−6  + 2 0−6
                                        7
                                            5
                                                 4
                                                     3
                                   = 2 + 2 + 2 + 2 + 2    −1  + 2 −3  + 2 −5  + 2 −6
                                                          1   1    1    1
                                   = 128 + 32 + 16 + 8 +    +   +    +
                                                          2   8   32   64
                                   = 184.671875 10
                     Note that in the above two examples, the patterns of bits are identical. The value of a number
                     depends upon how it is interpreted. The notation that we have introduced allows us to easily
                     specify exactly how a number is to be interpreted. For signed values, if the first bit is non-
                     zero, then the two’s complement should be taken before the number is evaluated. For example
                     the following figure shows an S(8,7) number that has a negative value.
   255   256   257   258   259   260   261   262   263   264   265