0

我想知道你是如何计算一个数字的反对数的。

4

2 回答 2

2

根据对数的底数使用Pow10()Pow() 。

如果 ,则以 10 为底a = log b (base10)的反对数为ab

于 2013-04-13T09:20:52.617 回答
1

例如:

package main

import (
        "fmt"
        "math"
)

func main() {
        for f := 1.0; f < 10; f *= 1.1 {
                fmt.Printf("10^%15f == %18f\n", f, math.Pow(10, f))
        }
}

操场


输出

10^       1.000000 ==          10.000000
10^       1.100000 ==          12.589254
10^       1.210000 ==          16.218101
10^       1.331000 ==          21.428906
10^       1.464100 ==          29.113874
10^       1.610510 ==          40.785895
10^       1.771561 ==          59.096397
10^       1.948717 ==          88.862208
10^       2.143589 ==         139.183839
10^       2.357948 ==         228.006743
10^       2.593742 ==         392.412163
10^       2.853117 ==         713.044618
10^       3.138428 ==        1375.397963
10^       3.452271 ==        2833.160736
10^       3.797498 ==        6273.332921
10^       4.177248 ==       15040.011538
10^       4.594973 ==       39352.559693
10^       5.054470 ==      113362.727116
10^       5.559917 ==      363008.933932
10^       6.115909 ==     1305897.362804
10^       6.727500 ==     5339492.112719
10^       7.400250 ==    25133324.832458
10^       8.140275 ==   138125842.074790
10^       8.954302 ==   900124188.827650
10^       9.849733 ==  7075101518.596476
于 2013-04-13T09:21:14.477 回答