1

It is a long time ago I used floating points, so I struggle with the following question and hope that you can help me out.

I need to list all numbers that can be represented exactly in a normalised floating- point number system with base 10, two digits in the fraction, and an exponent $0 ≤ e ≤ 2$. How many are there in total (including zero)? What is the machine epsilon?

Thank you in advance for your help!

1 Answers1

2

Wikipedia provides this formula to obtain the number of normalized floating-point numbers in a system:

$$2\cdot(B − 1)\cdot(B^{P − 1})\cdot(e_{max} − e_{min} + 1) + 1,$$ where $B$ is the base, $P$ is the precision, $e_{max}$ is the maximum exponent, and $e_{min}$ is the minimum exponent. See this post to see why the formula holds.

Substituting the required values gives that the number of numbers that can be represented in your normalized floating-point number system is 541.

The machine epsilon gives an upper bound on the relative error caused by rounding in floating-point arithmetic. It can be approximated by the formula $\dfrac{b^{p-1}}{2}$ or $b^{p-1}$, where $b$ is the base and $p$ is the precision. See this page for more details and for an algorithmic approach, you mind find this other post useful.