Mario's blog

By Mario, history, 4 years ago, In English
  • Vote: I like it
  • +1
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Precision problem, "long double" data type support a limited accuracy.

When x,y are small enough, there is no guarantee on the inequality $$$L<(L+R)/2<R$$$ and compiler may gives you something like $$$L=(L+R)/2\leq R$$$. For instance all char in your problem are 'l' and your position are $$$1/2,1/4...,1/2^n$$$. Can the computer differentiate $$$1/2^{999990}$$$ and $$$1/2^{999991}$$$ properly? (In fact it treats $$$1/2^{16446}$$$ as $$$0$$$)