Skip to content

Commit b5d160d

Browse files
authored
Update index.html
1 parent b32fe35 commit b5d160d

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

index.html

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,19 +1492,21 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
14921492
document.getElementById('segment-area').innerText = '';
14931493
return;
14941494
}
1495+
1496+
const ratio = 2 * height / length;
14951497

14961498
// Segment validity check
1497-
if ( (2 * height) > length) {
1498-
document.getElementById('segment-area').innerText = 'A circle-segment is less than half as high as long.';
1499-
return;
1500-
1501-
}
1502-
if ( 2 * height = length) {
1499+
1500+
if ( ratio = 1) {
15031501
document.getElementById('segment-area').innerText = 'If it is twice as long as high that is a semi-circle.';
15041502
return;
1503+
}
1504+
if ( ratio > 1) {
1505+
document.getElementById('segment-area').innerText = 'A circle-segment is less than half as high as long.';
1506+
return;
15051507
}
1508+
15061509

1507-
const ratio = 2 * height / length;
15081510
const angle = parseFloat(2 * Atan(ratio));
15091511
const sine = parseFloat(sin(angle));
15101512
const radius = parseFloat((length / 2 / sine).toFixed(5));
@@ -1791,15 +1793,17 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
17911793
}
17921794

17931795
// Cap validity check
1796+
1797+
if ( height = radius) {
1798+
document.getElementById('cap-volume').innerText = 'If the radius equals the height that is a hemisphere.';
1799+
return;
1800+
}
1801+
17941802
if ( height > radius) {
17951803
document.getElementById('cap-volume').innerText = 'The height of a spherical cap is shorter than its radius.';
17961804
return;
17971805
}
17981806

1799-
if ( height = radius) {
1800-
document.getElementById('cap-volume').innerText = 'If the radius equals the height that is a hemisphere.';
1801-
return;
1802-
}
18031807
document.getElementById('cap-volume').innerText =
18041808
`Volume: ${capVolume(radius, height).toFixed(5)} cubic units`;
18051809
}

0 commit comments

Comments
 (0)