The log10()
function in Ruby returns the logarithm of a number using base 10.
Figure 1 shows the mathematical representation of the log10()
function.
log10(number)
This function requires a number whose logarithm base 10 is to be calculated, and it must be greater than zero.
log10()
uses base 10 to return the logarithm of a number.
#exampleprint "log10(10) : ", Math.log10(10), "\n"print "log10(2) : ", Math.log10(2), "\n"#errorprint "log10(0) : ", Math.log10(0), "\n"