Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
i don't use y >= 0 because it can cause division by 0 here z /= (x + y). And the case where x = 0 and y = 0 in the formula gives n = 0 (only in this case).