(a float64, b float64)
| 14 | ) |
| 15 | |
| 16 | func UsingLog(a float64, b float64) float64 { |
| 17 | var p float64 |
| 18 | p = 1 |
| 19 | if a < 0 && int(b)&1 != 0 { |
| 20 | p = -1 |
| 21 | } |
| 22 | log := math.Log(math.Abs(a)) |
| 23 | exp := math.Exp(b * log) |
| 24 | result := exp * p |
| 25 | return math.Round(result) |
| 26 | } |
no outgoing calls