Skip to content

Commit 9caf8b2

Browse files
authored
Update index.html
1 parent b7117e2 commit 9caf8b2

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

index.html

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,29 +2239,38 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
22392239
<br>
22402240
<br>
22412241
<h18 style="margin-top:24px;">Test section</h18>
2242-
<label for="atan-input">Enter value (e.g. 2):</label>
2242+
2243+
2244+
<label for="atan-input">Enter a value (e.g. 2):</label>
22432245
<input type="number" id="atan-input" value="2" step="any" style="margin:8px;" />
22442246
<button onclick="testQueryAtan()">Run Test</button>
22452247

2246-
<pre id="atan-output" style="padding:12px; background:#eee;"></pre>
2248+
<pre id="atan-output" style="padding:12px; background:#eee; margin-top:12px;"></pre>
22472249

22482250
<script>
2251+
22492252
function testQueryAtan() {
22502253
const input = parseFloat(document.getElementById('atan-input').value);
22512254
const output = document.getElementById('atan-output');
2252-
const value = trig[key][funcType]; // ✅ direct access: trig["rad(1.467)"].tan
2253-
output.innerText = '';
2255+
output.innerText = '';
22542256

22552257
if (isNaN(input)) {
2256-
output.innerText = 'Invalid input.';
2258+
output.innerText = '⚠️ Invalid input.';
22572259
return;
22582260
}
22592261

22602262
try {
2261-
const match = findClosestValueMatch(input, 'tan'); // your engine function
2263+
const match = findClosestValueMatch(input, 'tan');
2264+
22622265
output.innerText += `🔍 Looking for tan ≈ ${input}\n\n`;
2266+
2267+
if (!match) {
2268+
output.innerText += `⚠️ No match found for tan ≈ ${input}`;
2269+
return;
2270+
}
2271+
22632272
output.innerText += `🗝️ Best match key: ${match.angle}\n`;
2264-
output.innerText += `📐 Approximated tan: ${value ?? '⛔ not found'}\n`;
2273+
output.innerText += `📐 Approximated tan: ${match.approx}`;
22652274
} catch (err) {
22662275
output.innerText = '⚠️ Error during query:\n' + err.message;
22672276
}

0 commit comments

Comments
 (0)