From d8292d4eadf63f7ee91be431c99ffde88bef73ef Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Wed, 17 Jan 2024 09:38:44 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- matlab/2/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/matlab/2/README.md b/matlab/2/README.md index 64e46f3..e01aa40 100644 --- a/matlab/2/README.md +++ b/matlab/2/README.md @@ -142,6 +142,16 @@ end x = x*2; ``` +```python +x: float = 1.0 + +while 1 + x != 1: + x = x / 2 + +x = x * 2 +print(x) +``` + One might think that this constitutes an infinite loop. To the contrary, the loop will be left in finite time. The result for double precision is $x \approx 2\times 10^{-16}$ (= Matlab variable eps). eps is the smallest number with $1+$eps$>1$, and is the \quoting{machine accuracy}. Rounding errors of this order of magnitude occur on a regular basis. For example, Matlab calculates $\sin{\pi} \approx 1.2246\times 10^{-16}$. It shall be mentioned hat the machine accuracy for double precision is exactly eps $= 2^{-52}$,