File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -778,20 +778,20 @@ <h4 style="font-size:160%;margin:7px">Trigonometry</h4>
778778 }
779779}
780780
781- function findClosestValueMatch ( value , funcType ) {
781+ function findClosestValueMatch ( input , funcType ) {
782782 let bestMatch = null ;
783783 let minDiff = Infinity ;
784784
785785 for ( const key in trig ) {
786- const raw = trig [ key ] [ funcType ] ;
787- if ( typeof raw !== 'number' ) continue ;
786+ const value = trig [ key ] [ funcType ] ;
787+ if ( typeof value !== 'number' ) continue ;
788788
789- const diff = Math . abs ( raw - value ) ;
790- if ( diff < minDiff ) {
791- minDiff = diff ;
789+ const joker = Math . abs ( value - input ) ;
790+ if ( joker < minDiff ) {
791+ minDiff = joker ;
792792 bestMatch = {
793- angle : key ,
794- approx : raw
793+ angle : key , // We're using this key as the input (the angle) that produced the value
794+ value : value
795795 } ;
796796 }
797797 }
You can’t perform that action at this time.
0 commit comments