Skip to content

Commit d01f632

Browse files
authored
Update index.html
1 parent 1a27744 commit d01f632

1 file changed

Lines changed: 17 additions & 24 deletions

File tree

index.html

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ <h4 style="font-size:160%;margin:7px">Trigonometry</h4>
637637
"rad(1.6)": {
638638
"sin": 1,
639639
"cos": 0,
640-
"tan": 0,
640+
"tan": undefined,
641641
"deg": 90.0
642642
},
643643

@@ -2237,38 +2237,31 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
22372237
<br>
22382238
<br>
22392239
<h18 style="margin-top:24px;">Test section</h18>
2240+
<label for="atan-input">Enter value (e.g. 2):</label>
2241+
<input type="number" id="atan-input" value="2" step="any" style="margin:8px;" />
2242+
<button onclick="testQueryAtan()">Run Test</button>
22402243

2241-
<button onclick="inspectTrig()">Inspect Trig</button>
2242-
2243-
<pre id="trig-output" style="padding:12px; background:#eee; margin-top:12px;"></pre>
2244+
<pre id="atan-output" style="padding:12px; background:#eee;"></pre>
22442245

22452246
<script>
2246-
function inspectTrig() {
2247-
const output = document.getElementById('trig-output');
2247+
function testQueryAtan() {
2248+
const input = parseFloat(document.getElementById('atan-input').value);
2249+
const output = document.getElementById('atan-output');
22482250
output.innerText = '';
22492251

2250-
if (typeof trig !== 'object') {
2251-
output.innerText = '⚠️ Trig object not defined or not accessible.';
2252+
if (isNaN(input)) {
2253+
output.innerText = 'Invalid input.';
22522254
return;
22532255
}
22542256

2255-
const keys = Object.keys(trig);
2256-
if (keys.length === 0) {
2257-
output.innerText = '⚠️ Trig dataset is empty.';
2258-
return;
2257+
try {
2258+
const match = findClosestValueMatch(input, 'tan'); // your engine function
2259+
output.innerText += `🔍 Looking for tan ≈ ${input}\n\n`;
2260+
output.innerText += `🗝️ Best match key: ${match.angle}\n`;
2261+
output.innerText += `📐 Approximated tan: ${match.approx}\n`;
2262+
} catch (err) {
2263+
output.innerText = '⚠️ Error during query:\n' + err.message;
22592264
}
2260-
2261-
output.innerText += `✅ Trig dataset loaded.\n\nKeys found:\n`;
2262-
2263-
keys.forEach(key => {
2264-
const entry = trig[key];
2265-
const sin = entry.sin ?? '⛔ not defined';
2266-
const tan = entry.tan ?? '⛔ not defined';
2267-
2268-
output.innerText += `• ${key}\n`;
2269-
output.innerText += ` sin: ${typeof sin === 'object' ? JSON.stringify(sin) : sin}\n`;
2270-
output.innerText += ` tan: ${typeof tan === 'object' ? JSON.stringify(tan) : tan}\n\n`;
2271-
});
22722265
}
22732266
</script>
22742267
<footer>

0 commit comments

Comments
 (0)