Determine whether a triangle with given side lengths is a right triangle, with special constraints on the calculation.

300 Views Asked by At

Given a triangle with sides $a, b, c$ such that $0.000001 < a \leq b \leq c < 1000000$, is it possible (and if so, how) to determine whether the triangle is a right angle triangle, while having the magnitude of all intermediate results of the calculation stay between $0.000001$ and $1000000$?

The problem comes with squaring the lengths while using Pythagorean theorem or the law of cosines: the values of squares might get beyond the given bounds. If all lengths are small or all large, they can be appropriately scaled in order to be able to be squared, but I'm having troubles figuring out what to do if $a$ happens to be close to the lower bound while $b$ and $c$ are close to the upper bound.

1

There are 1 best solutions below

3
On

you may be able to calculate it using "median of right-triangle hypotenuse is always half of it" Use the two points of the hypotenuse to get its size. then calculate the mid point of hypotenuse and calculate its distance from the right angle. if the former is twice the latter, you've got a right-angle triangle