File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -992,26 +992,30 @@ <h4 style="font-size:160%;margin:7px">Trigonometry</h4>
992992 return bestMatch ;
993993}
994994
995- function Atan ( x ) {
995+ export function Atan ( x ) {
996996 if ( typeof x !== 'number' || isNaN ( x ) || x <= 0 ) return null ;
997997
998- let match = null ;
998+ let radian = null ;
999999
1000- // Direct match zone
10011000 if ( x > 1 || x < 0.089 ) {
1002- match = closestValue ( x , 'tan' ) ;
1001+ // Direct match
1002+ const match = closestValue ( x , 'tan' ) ;
1003+ if ( ! match ?. angle ) return null ;
1004+ const parsed = match . angle . match ( / r a d \( ( [ \d . ] + ) \) / ) ;
1005+ if ( ! parsed ) return null ;
1006+ radian = parseFloat ( parsed [ 1 ] ) ;
10031007 } else {
1004- // Reflective zone (0.089 < x < 1)
1008+ // Reflective zone
10051009 const reciprocal = 1 / x ;
1006- match = 1.6 - closestValue ( reciprocal , 'tan' ) ;
1010+ const match = closestValue ( reciprocal , 'tan' ) ;
1011+ if ( ! match ?. angle ) return null ;
1012+ const parsed = match . angle . match ( / r a d \( ( [ \d . ] + ) \) / ) ;
1013+ if ( ! parsed ) return null ;
1014+ const reflected = parseFloat ( parsed [ 1 ] ) ;
1015+ radian = 1.6 - reflected ;
10071016 }
10081017
1009- if ( ! match ?. angle ) return null ;
1010-
1011- const angleMatch = match . angle . match ( / r a d \( ( [ \d . ] + ) \) / ) ;
1012- if ( ! angleMatch ) return null ;
1013-
1014- return parseFloat ( angleMatch [ 1 ] ) ;
1018+ return radian ;
10151019}
10161020
10171021</ script >
You can’t perform that action at this time.
0 commit comments