alhudz commented on PR #1709:
URL: https://github.com/apache/commons-lang/pull/1709#issuecomment-4730850299

   Makes sense, done. Used `Math.toIntExact` for the final numerator and 
`Math.addExact`/`Math.subtractExact` for the sum.
   
   The one catch is the `(int, int)` variants can't sit on the cross products 
directly: `u*v'` and `u'*v` overflow an `int` even when the reduced result 
fits, which is the actual bug here. So each cross product is widened to `long` 
first, then the exact helpers do the add/subtract and `toIntExact` narrows 
back. `FractionTest` passes (35/35).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to