3

enter image description here

Just wanna make sure that I didn't make any mistakes. I use the bisection method to calculate $P_n$ and find out a pattern, which is $P_n= \left(-1\right)^{n+1}2^{-n}$. So the largest number that n can be is 1022 to avoid underflow. Is this correct?

J.doe
  • 1,417
  • 1
  • 17
  • 31

1 Answers1

5

No, you have to consider subnormal numbers too. Assuming with standard you mean IEEE binary double (i.e. binary64), the smallest non-zero number has magnitude $2^{-1074}\approx 4.94\times10^{-324}$ and therefore you will have $n=1074.\;$ Step $1075$ will underflow to zero.

The last generated intervalls will be:

1071    -7.90505033345994471E-0323     3.95252516672997235E-0323
1072    -1.97626258336498618E-0323     3.95252516672997235E-0323
1073    -1.97626258336498618E-0323     9.88131291682493088E-0324
1074    -4.94065645841246544E-0324     9.88131291682493088E-0324
1075    -4.94065645841246544E-0324     0.00000000000000000E+0000

Note that in actual programming languages and/or systems subnormal floating point numbers may be disabled and your $n$ would be correct.

gammatester
  • 18,827