Re: A simplification error when calculating array lengths

2014-04-07 Thread Steven Schveighoffer
On Fri, 04 Apr 2014 18:30:28 -0400, Ali Çehreli wrote: (This was in C and probably a common mistake that I haven't experienced until today.) tldr; The following two expressions are not equivalent: a)length - 1 - length / 2 b)length / 2 - 1 I was trying to write a recursive fu

A simplification error when calculating array lengths

2014-04-04 Thread Ali Çehreli
(This was in C and probably a common mistake that I haven't experienced until today.) tldr; The following two expressions are not equivalent: a)length - 1 - length / 2 b)length / 2 - 1 I was trying to write a recursive function similar to binary search: - Process the middle elemen