Skip to content

Commit ea0b5b1

Browse files
authored
Update index.html
1 parent a7488b8 commit ea0b5b1

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

index.html

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -993,18 +993,25 @@ <h4 style="font-size:160%;margin:7px">Trigonometry</h4>
993993
}
994994

995995
function Atan(x) {
996-
if (typeof x !== 'number' || isNaN(x) || x <= 0) return null;
996+
if (typeof x !== 'number' || isNaN(x) || x <= 0) return null;
997997

998-
// Direct match zone
999-
if (x > 1 || x < 0.089) {
1000-
const match = closestValue(x, 'tan');
1001-
return match?.angle ?? null;
1002-
}
998+
let match = null;
999+
1000+
// Direct match zone
1001+
if (x > 1 || x < 0.089) {
1002+
match = closestValue(x, 'tan');
1003+
} else {
1004+
// Reflective zone (0.089 < x < 1)
1005+
const reciprocal = 1 / x;
1006+
match = closestValue(reciprocal, 'tan');
1007+
}
1008+
1009+
if (!match?.angle) return null;
1010+
1011+
const angleMatch = match.angle.match(/rad\(([\d.]+)\)/);
1012+
if (!angleMatch) return null;
10031013

1004-
// Reflective zone (0.089 < x < 1)
1005-
const reciprocal = 1 / x;
1006-
const match = closestValue(reciprocal, 'tan');
1007-
return match?.angle ?? null;
1014+
return parseFloat(angleMatch[1]);
10081015
}
10091016

10101017
</script>

0 commit comments

Comments
 (0)