How are exponents calculated?

前端 未结 5 853
抹茶落季
抹茶落季 2020-12-15 13:25

I\'m trying to determine the asymptotic run-time of one of my algorithms, which uses exponents, but I\'m not sure of how exponents are calculated programmatically.

I

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 13:45

    You can use exp(n*ln(x)) for calculating xn. Both x and n can be double-precision, floating point numbers. Natural logarithm and exponential function can be calculated using Taylor series. Here you can find formulas: http://en.wikipedia.org/wiki/Taylor_series

提交回复
热议问题