Skip to content

Commit 8eb68ae

Browse files
RomanSteinbergadamant-pwn
authored andcommitted
docs: add reference to the JDK error
1 parent 5738684 commit 8eb68ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/num_methods/binary_search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ while (r - l > 1) {
7171

7272
During the execution of the algorithm, we never evaluate neither $A_L$ nor $A_R$, as $L < M < R$. In the end, $L$ will be the index of the last element that is not greater than $k$ (or $-1$ if there is no such element) and $R$ will be the index of the first element larger than $k$ (or $n$ if there is no such element).
7373

74-
**Note.** If one calculates `m` as follows `m = (r + l) / 2` it can lead to overflow. It is funny fact that this error lived about 7 years in some Java library which was discussed on Redit.
74+
**Note.** If one calculates `m` as follows `m = (r + l) / 2` it can lead to overflow. It is funny fact that this error lived about 9 years in JDK as described in the [blogpost](https://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html).
7575

7676
## Search on arbitrary predicate
7777

0 commit comments

Comments
 (0)