What is the formula for calculating several powers in php

WBOY
Release: 2023-03-15 16:48:01
Original
3376 people have browsed it

The calculation formula for several powers in PHP is "$x=pow(base, exponent);", and the value of variable x is the result of the power calculation. The pow() function can calculate and return the result of the specified power of the specified number. The first parameter specifies the base of the exponential expression, and the second parameter specifies the power of the exponential expression. If it cannot be calculated, the returned result is NAN.

What is the formula for calculating several powers in php

The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer.

What is the calculation formula for several powers in php

The calculation formula is:

$x=pow(底数,指数);
Copy after login

Function: The function of the pow() function is to calculate a number to the nth power Return

Syntax:

pow(X,Y);
Copy after login

Parameters:

X represents the number to be processed

Y represents the n value in the specified nth power

Description: Returns the Y power of X. If the parameters are correct, the function will return a numerical value. If it cannot be calculated, it will return NAN.

Examples are as follows:

<?php
echo(pow(2,4) . "<br>");
echo(pow(-2,4) . "<br>");
echo(pow(-2,-4) . "<br>");
echo(pow(-2,-3.2));
?>
Copy after login

Output results:

What is the formula for calculating several powers in php

## Recommended learning: "

PHP Video Tutorial

The above is the detailed content of What is the formula for calculating several powers in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!