| 1 | module math |
| 2 | |
| 3 | fn C.log(x f64) f64 |
| 4 | fn C.log2(x f64) f64 |
| 5 | fn C.log10(x f64) f64 |
| 6 | fn C.log1p(x f64) f64 |
| 7 | fn C.logb(x f64) f64 |
| 8 | fn C.logf(x f32) f32 |
| 9 | |
| 10 | // log returns the natural logarithm of x (float64) |
| 11 | @[inline] |
| 12 | pub fn log(x f64) f64 { |
| 13 | return C.log(x) |
| 14 | } |
| 15 | |
| 16 | // log2 returns the binary logarithm of x (float64). |
| 17 | // The special cases are the same as for log. |
| 18 | @[inline] |
| 19 | pub fn log2(x f64) f64 { |
| 20 | return C.log2(x) |
| 21 | } |
| 22 | |
| 23 | // log10 returns the decimal logarithm of x (float64). |
| 24 | // The special cases are the same as for log. |
| 25 | @[inline] |
| 26 | pub fn log10(x f64) f64 { |
| 27 | return C.log10(x) |
| 28 | } |
| 29 | |
| 30 | // log1p returns log(1+x). |
| 31 | @[inline] |
| 32 | pub fn log1p(x f64) f64 { |
| 33 | return C.log1p(x) |
| 34 | } |
| 35 | |
| 36 | // log_b returns the binary exponent of x. |
| 37 | pub fn log_b(x f64) f64 { |
| 38 | return C.logb(x) |
| 39 | } |
| 40 | |
| 41 | // log returns the natural logarithm of x (float32) |
| 42 | @[inline] |
| 43 | pub fn logf(x f32) f32 { |
| 44 | return C.logf(x) |
| 45 | } |
| 46 | |