File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff 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 ) ) ;
You can’t perform that action at this time.
0 commit comments