Program to compute log a to any base b ( logb a ) | Javascript program to find log ( a ) on any base b ; Driver code
function log_a_to_base_b ( a , b ) { return parseInt ( Math . log ( a ) / Math . log ( b ) ) ; } var a = 3 ; var b = 2 ; document . write ( log_a_to_base_b ( a , b ) + " " ) ; a = 256 ; b = 4 ; document . write ( log_a_to_base_b ( a , b ) ) ;