text: Comparing X ^ Y and Y ^ X for very large values of X and Y | C ++ implementation of the approach ; Function to compare x ^ y and y ^ x ; Storing values OF x ^ y AND y ^ x ; Comparing values ; Driver code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; void compareVal ( int x , int y ) { long double a = y * log ( x ) ; long double b = x * log ( y ) ; if ( a > b ) cout << x << " ^ " << y << " ▁ > ▁ " << y << " ^ " << x ; else if ( a < b ) cout << x << " ^ " << y << " ▁ < ▁ " << y << " ^ " << x ; else if ( a == b ) cout << x << " ^ " << y << " ▁ = ▁ " << y << " ^ " << x ; } int main ( ) { long double x = 4 , y = 5 ; compareVal ( x , y ) ; return 0 ; }