Skip to content

Commit c967e2c

Browse files
authored
Update index.html
1 parent 85f5f3a commit c967e2c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

index.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,15 +1472,20 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
14721472
return;
14731473
}
14741474

1475-
const ratio = parseFloat((2 * height / length).toFixed(5));
1475+
const ratio = 2 * height / length;
14761476

14771477
// Segment validity check
14781478

1479-
if (ratio < 0.11 || ratio > 1) {
1480-
document.getElementById('segment-area').innerText = 'The ratio is out of range';
1481-
return;
1479+
if ( ratio === 0) {
1480+
document.getElementById('segment-area').innerText = '';
1481+
return;
14821482
}
14831483

1484+
if (ratio < 0.11 || ratio > 1) {
1485+
document.getElementById('segment-area').innerText = 'This ratio is out of range';
1486+
return;
1487+
}
1488+
14841489
const angle = parseFloat(2 * Atan(ratio));
14851490
const sine = parseFloat(sin(angle));
14861491
const radius = parseFloat((length / 2 / sine).toFixed(5));

0 commit comments

Comments
 (0)