Golang:计算数字的反对数

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


慕娘9325324
浏览 291回答 2
2回答

HUWWW

根据对数的底数使用Pow10()或Pow()。如果 a = log b (base10),a则以 10 为底的反对数是b

慕雪6442864

例如:package mainimport (&nbsp; &nbsp; &nbsp; &nbsp; "fmt"&nbsp; &nbsp; &nbsp; &nbsp; "math")func main() {&nbsp; &nbsp; &nbsp; &nbsp; for f := 1.0; f < 10; f *= 1.1 {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fmt.Printf("10^%15f == %18f\n", f, math.Pow(10, f))&nbsp; &nbsp; &nbsp; &nbsp; }}输出10^&nbsp; &nbsp; &nbsp; &nbsp;1.000000 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10.00000010^&nbsp; &nbsp; &nbsp; &nbsp;1.100000 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 12.58925410^&nbsp; &nbsp; &nbsp; &nbsp;1.210000 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 16.21810110^&nbsp; &nbsp; &nbsp; &nbsp;1.331000 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 21.42890610^&nbsp; &nbsp; &nbsp; &nbsp;1.464100 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 29.11387410^&nbsp; &nbsp; &nbsp; &nbsp;1.610510 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 40.78589510^&nbsp; &nbsp; &nbsp; &nbsp;1.771561 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 59.09639710^&nbsp; &nbsp; &nbsp; &nbsp;1.948717 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 88.86220810^&nbsp; &nbsp; &nbsp; &nbsp;2.143589 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;139.18383910^&nbsp; &nbsp; &nbsp; &nbsp;2.357948 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;228.00674310^&nbsp; &nbsp; &nbsp; &nbsp;2.593742 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;392.41216310^&nbsp; &nbsp; &nbsp; &nbsp;2.853117 ==&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;713.04461810^&nbsp; &nbsp; &nbsp; &nbsp;3.138428 ==&nbsp; &nbsp; &nbsp; &nbsp; 1375.39796310^&nbsp; &nbsp; &nbsp; &nbsp;3.452271 ==&nbsp; &nbsp; &nbsp; &nbsp; 2833.16073610^&nbsp; &nbsp; &nbsp; &nbsp;3.797498 ==&nbsp; &nbsp; &nbsp; &nbsp; 6273.33292110^&nbsp; &nbsp; &nbsp; &nbsp;4.177248 ==&nbsp; &nbsp; &nbsp; &nbsp;15040.01153810^&nbsp; &nbsp; &nbsp; &nbsp;4.594973 ==&nbsp; &nbsp; &nbsp; &nbsp;39352.55969310^&nbsp; &nbsp; &nbsp; &nbsp;5.054470 ==&nbsp; &nbsp; &nbsp; 113362.72711610^&nbsp; &nbsp; &nbsp; &nbsp;5.559917 ==&nbsp; &nbsp; &nbsp; 363008.93393210^&nbsp; &nbsp; &nbsp; &nbsp;6.115909 ==&nbsp; &nbsp; &nbsp;1305897.36280410^&nbsp; &nbsp; &nbsp; &nbsp;6.727500 ==&nbsp; &nbsp; &nbsp;5339492.11271910^&nbsp; &nbsp; &nbsp; &nbsp;7.400250 ==&nbsp; &nbsp; 25133324.83245810^&nbsp; &nbsp; &nbsp; &nbsp;8.140275 ==&nbsp; &nbsp;138125842.07479010^&nbsp; &nbsp; &nbsp; &nbsp;8.954302 ==&nbsp; &nbsp;900124188.82765010^&nbsp; &nbsp; &nbsp; &nbsp;9.849733 ==&nbsp; 7075101518.596476
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go