Determination of triangle type incorrect
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
"triangle" shows wrong outputs for certain inputs. In particular:
```
unimatrix0 joe [~/tmp/triangle/triangle]: python3 cli.py check 1 2 2.23606797749979
OUTPUT: TODO
unimatrix0 joe [~/tmp/triangle/triangle]: python3 cli.py check 3 4 5
OUTPUT: Scalene
unimatrix0 joe [~/tmp/triangle/triangle]: python3 cli.py check 3 5 7
OUTPUT: TODO
```
The first and second run should show "right triangle", but show either TODO or Scalene. Run three should show "scalene", but shows TODO.
Also I believe there's a numerical issue when comparing floating-point numbers. I.e., instead of checking for equality like ``a == b``, it could make sense to substitute ``abs(a - b) < epsilon`` with a predefined epsilon value (e.g., 1e-6 or so) in order to avoid numerical issues.
Best regards,
Johannes
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with cli.py and reproduce the three commands shown in the report. Inspect the triangle classification and numeric comparisons, then verify that the first two commands report right triangles and the third reports Scalene, including behavior for near-equal floating-point values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100