The binary search solution has l = 1, r = 1.5e9. Consider these two testcases:
2 1
0 0
1 0
and
1 1000000000
-1000000000 1000000000
For the first one the answer is 0.5, and for the second one the answer is sqrt(5) * 1e9. The stack solution outputs these correctly, but the binary search outputs 1 and 1.5e9.