They're equivalent in the mathematical sense, but not in the floating-point sense. This is a permanent problem with floating point numbers.
for example, if (r1 + r2) is really small, the precision of its product (r1 + r2) * (r1 + r2) is going to be bad ... so it's better to avoid multiplications if you can in a formula like this
(i didnt look at the JS translation so it's just my guess)
(r1 + r2)
(r1 + r2) * (r1 + r2)
This comment is hidden because it contains spoiler information about the solution