Comparing X ^ Y and Y ^ X for very large values of X and Y | Function to compare x ^ y and y ^ x ; Storing values OF x ^ y AND y ^ x ; Comparing values ; Driver code
function compareVal ( x , y ) { let a = y * Math . log ( x ) ; let b = x * Math . log ( y ) ; if ( a > b ) document . write ( x + " " + y + " " + y + " " + x ) ; else if ( a < b ) document . write ( x + " " + y + " " + y + " " + x ) ; else if ( a == b ) document . write ( x + " " + y + " " + y + " " + x ) ; } let x = 4 , y = 5 ; compareVal ( x , y ) ;