- #1
CGandC
- 322
- 34
I've started reading A concise introduction to numerical analysis, A.C. Foul and on the first page there's the following paragraph about how a floating point in fixed point precision can be represented:
I don't understand the example where it says " ##\beta=2## and ##p=20##, the decimal number 0.1 cannot be represented exactly but is approximately ##1.1001100110011001100 \times 2^{-4}## " . How did the author arrive to ##1.1001100110011001100 \times 2^{-4}##?
I've tried arriving to the result using a method ( I don't know how it's called, I've met in on the internet so I have no idea about its correctness ) in which one keeps multiplying the number after the decimal point by 2 and if it goes past 1.0 then we add 1 to the output, else we add 0 to the output. Also, using a decimal float to binary converter on the web such as on the site https://www.exploringbinary.com/floating-point-converter/ , doesn't give me the author's result.
We live in a continuous world with infinitely many real numbers. However, a computer has only a finite number of bits. This requires an approximate representation. In the past, several different representations of real numbers have been suggested, but now the most widely used by far is the floating point representation. Each floating point representations has a base ##\beta## (which is always assumed to be even) which is typically 2 (binary), 8 (octal), 10 (decimal), or 16 (hexadecimal), and a precision ##p## which is the number of digits (of base ##\beta## ) held in a floating point number. For example, if ##\beta=10## and ##p=5##, the number 0.1 is represented as ##1.0000 \times 10^{-1}##. On the other hand, if ##\beta=2## and ##p=20##, the decimal number 0.1 cannot be represented exactly but is approximately ##1.1001100110011001100 \times 2^{-4}##. We can write the representation as ##\pm d_0 . d_1 \cdots d_{p-1} \times \beta^e##, where ##d_0 . d_1 \cdots d_{p-1}## is called the significand (or mantissa) and has ##p## digits and ##e## is the exponent. If the leading digit ##d_0## is non-zero, the number is said to be normalized. More precisely ##\pm d_0 . d_1 \cdots d_{p-1} \times \beta^e## is the number
##
\pm\left(d_0+d_1 \beta^{-1}+d_2 \beta^{-2}+\cdots+d_{p-1} \beta^{-(p-1)}\right) \beta^\epsilon, 0 \leq d_i<\beta
##
I don't understand the example where it says " ##\beta=2## and ##p=20##, the decimal number 0.1 cannot be represented exactly but is approximately ##1.1001100110011001100 \times 2^{-4}## " . How did the author arrive to ##1.1001100110011001100 \times 2^{-4}##?
I've tried arriving to the result using a method ( I don't know how it's called, I've met in on the internet so I have no idea about its correctness ) in which one keeps multiplying the number after the decimal point by 2 and if it goes past 1.0 then we add 1 to the output, else we add 0 to the output. Also, using a decimal float to binary converter on the web such as on the site https://www.exploringbinary.com/floating-point-converter/ , doesn't give me the author's result.