Check whether two numbers are in golden ratio | Function to check that two numbers are in golden ratio ; Swapping the numbers such that A contains the maximum number between these numbers ; First Ratio ; Second Ratio ; Condition to check that two numbers are in golden ratio ; Driver Code ; Function Call
function checkGoldenRatio ( a , b ) { if ( a <= b ) { let temp = a ; a = b ; b = temp ; } let ratio1 = ( a / b ) . toFixed ( 3 ) ; let ratio2 = ( ( a + b ) / a ) . toFixed ( 3 ) ; if ( ( ratio1 == ratio2 ) && ratio1 == " " ) { document . write ( " " ) ; return true ; } else { document . write ( " " ) ; return false ; } } let a = 0.618 ; let b = 1 ; checkGoldenRatio ( a , b ) ;