英文:
Golang: Computing Anti-log of a number
问题
我想知道你是如何计算一个数的反对数的。
英文:
I wanted to know how it is that you compute the anti-log of a number.
答案1
得分: 2
如果a = log b (base10)
,那么以10为底数的a
的反对数是b
。
英文:
Using Pow10() or Pow() depending on the base of your logarithm.
if a = log b (base10)
, then the anti-log of a
to the base 10 is b
答案2
得分: 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))
}
}
英文:
For example:
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))
}
}
Output
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论