本文簡要介紹ruby語言中 Math.log
的用法。
用法
log(x) → Float
log(x, base) → Float
返回 x
的對數。如果給出額外的第二個參數,它將是對數的底。否則為e
(自然對數)。
域:(0,無窮大)
共域:(-INFINITY,INFINITY)
Math.log(0) #=> -Infinity
Math.log(1) #=> 0.0
Math.log(Math::E) #=> 1.0
Math.log(Math::E**3) #=> 3.0
Math.log(12, 3) #=> 2.2618595071429146
相關用法
- Ruby Math.log10用法及代碼示例
- Ruby Math.log2用法及代碼示例
- Ruby Math.lgamma用法及代碼示例
- Ruby Math.ldexp用法及代碼示例
- Ruby Math.acosh用法及代碼示例
- Ruby Math.asinh用法及代碼示例
- Ruby Math.sinh用法及代碼示例
- Ruby Math.cbrt用法及代碼示例
- Ruby Math.atan用法及代碼示例
- Ruby Math.asin用法及代碼示例
- Ruby Math.gamma用法及代碼示例
- Ruby Math.erf用法及代碼示例
- Ruby Math.cosh用法及代碼示例
- Ruby Math.tan用法及代碼示例
- Ruby Math.erfc用法及代碼示例
- Ruby Math.tanh用法及代碼示例
- Ruby Math.frexp用法及代碼示例
- Ruby Math.exp用法及代碼示例
- Ruby Math.acos用法及代碼示例
- Ruby Math.sqrt用法及代碼示例
- Ruby Math.cos用法及代碼示例
- Ruby Math.atan2用法及代碼示例
- Ruby Math.atanh用法及代碼示例
- Ruby Math.sin用法及代碼示例
- Ruby Math.hypot用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Math.log。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。