Home  >  Article  >  Backend Development  >  How to calculate if PHP is raised to the nth power?

How to calculate if PHP is raised to the nth power?

WBOY
WBOYOriginal
2016-08-04 09:21:152159browse

PHP has the square root function sqrt(), but now I want to raise the 1.2th power of a number. Is there any good way? Can you only write a function yourself?

Reply content:

PHP has the square root function sqrt(), but now I want to raise the 1.2th power of a number. Is there any good way? Can you only write a function yourself?

Wrong reading=. = , use pow(). Mathematical principles The square root of 25 will be 25 raised to the 1/2 power, so the 1.2 raised power of 25 will be 25 raised to the 1/1.2 power pow(25,1/1.2)

Use the pow() function, for example, 100 raised to the power 1.2 is 100 raised to the power 1/1.2, written as pow(100,1/1.2)

php5.6 uses echo 25**(1/1.2);//14.620088691064

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn