Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pow(3) [php man page]

POW(3)									 1								    POW(3)

pow - Exponential expression

SYNOPSIS
number pow (number $base, number $exp) DESCRIPTION
Returns $base raised to the power of $exp. Note In PHP 5.6 onwards, you may prefer to use the ** operator. PARAMETERS
o $base - The base to use o $exp - The exponent RETURN VALUES
$base raised to the power of $exp. If both arguments are non-negative integers and the result can be represented as an integer, the result will be returned with integer type, otherwise it will be returned as a float. EXAMPLES
Example #1 Some examples of pow(3) <?php var_dump(pow(2, 8)); // int(256) echo pow(-1, 20); // 1 echo pow(0, 0); // 1 echo pow(-1, 5.5); // PHP >4.0.6 NAN echo pow(-1, 5.5); // PHP <=4.0.6 1.#IND ?> NOTES
Note This function will convert all input to a number, even non-scalar values, which could lead to weird results. SEE ALSO
exp(3), sqrt(3), bcpow(3), gmp_pow(3). PHP Documentation Group POW(3)

Check Out this Related Man Page

POW(3)							   BSD Library Functions Manual 						    POW(3)

NAME
pow -- power function SYNOPSIS
#include <math.h> double pow(double x, double y); long double powl(long double x, long double y); float powf(float x, float y); DESCRIPTION
The pow() functions compute x raised to the power y. SPECIAL VALUES
pow(+-0, y) returns +-infinity and raises the "divide-by-zero" floating-point exception for y an odd integer < 0. pow(+-0, y) returns +infinity and raises the "divide-by-zero" floating-point exception for y < 0 and not an odd integer. pow(+-0, y) returns +-0 for y an odd integer > 0. pow(+-0, y) returns +0 for y > 0 and not an odd integer. pow(-1, +-infinity) returns 1. pow(1, y) returns 1 for any y, even a NaN. pow(x, +-0) returns 1 for any x, even a NaN. pow(x, y) returns a NaN and raises the "invalid" floating-point exception for finite x < 0 and finite non-integer y. pow(x, -infinity) returns +infinity for |x| < 1. pow(x, -infinity) returns +0 for |x| > 1. pow(x, +infinity) returns +0 for |x| < 1. pow(x, +infinity) returns +infinity for |x| > 1. pow(-infinity, y) returns -0 for y an odd integer < 0. pow(-infinity, y) returns +0 for y < 0 and not an odd integer. pow(-infinity, y) returns -infinity for y an odd integer > 0. pow(-infinity, y) returns +infinity for y > 0 and not an odd integer. pow(+infinity, y) returns +0 for y < 0. pow(+infinity, y) returns +infinity for y > 0. A domain error occurs if x is finite and negative and y is finite and not an integer. A domain error can occur if x is 0 and y less than or equal to 0. Range errors may occur. VECTOR OPERATIONS
If you need to apply the pow() functions to SIMD vectors or arrays, using the following functions provided by the Accelerate.framework may give significantly better performance: #include <Accelerate/Accelerate.h> vFloat vpowf(vFloat x, vFloat y); vFloat vpowf(vFloat x, vSInt32 y); void vvpowf(float *z, const float *y, const float *x, const int *n); void vvpow(double *z, const double *y, const double *x, const int *n); void vvpowsf(float *z, const float *y, const float *x, const int *n); void vvpows(double *z, const double *y, const double *x, const int *n); SEE ALSO
exp(3) math(3) STANDARDS
The pow() function conforms to ISO/IEC 9899:2011. 4th Berkeley Distribution December 11, 2006 4th Berkeley Distribution
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in using power function in Bash

Hi, I would like to use a power function in Bash in an awk '{ } . e.g pow(2,3)=8 Any suggestion? I try to find online resources but most of them stated by using BC. Please advise. Thanks. (3 Replies)
Discussion started by: ahjiefreak
3 Replies

2. UNIX for Advanced & Expert Users

Weird Awk issue

Hi All, a bit of a weird one here. I'm trying to pass a variable into an awk command, and I keep getting an error. I have the line nawk -F"," -v red=$random_variable '{print $red}' $w_dir/$file_name > $w_dir/${column_name} that keeps failing with the error nawk: can't open file {print... (17 Replies)
Discussion started by: Khoomfire
17 Replies

3. UNIX for Dummies Questions & Answers

extract a part of a path like (input: /etc/exp/home/bin ====> output: exp)

Hi, I need to make some extraction . with the following input to get the right output. input: /etc/exp/home/bin ====> output: exp and input: aex1234 ===> output: ex Thanks for your help, (4 Replies)
Discussion started by: yeclota
4 Replies

4. Shell Programming and Scripting

Airthmatic Expression

Hi, I want to calculate in terms of power. for example = 16 pow 2 =256 i don't know what function to use in unix to calculate power. Please help me. ravi (3 Replies)
Discussion started by: ravi_rn
3 Replies

5. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

6. Shell Programming and Scripting

Regex for for integer from 0-7 except 2

Hi, I am trying to use a regular exp to match any number between 0 and 7 except 2...... I am using: echo $myvar | egrep "{1}{1}" Which isnt working.... Please can someone help? Thanks yonderboy (10 Replies)
Discussion started by: yonderboy
10 Replies

7. UNIX for Dummies Questions & Answers

exp command to extract particular rows

Hi, I'm new to unix so hopefully you can help! I'm using the below command to extract a tables contents and store it in a dmp file: exp OWNER/OWNER@LINK FILE=exp.dat TABLES=TABLE_TEST This works fine and dumps the table into the exp.dat file. What i can't figure out, is how to... (3 Replies)
Discussion started by: boijie
3 Replies

8. Shell Programming and Scripting

Script to raise a integer by a exponent (while loop)

I am trying to write a script that raises a integer (m) by a exponent (n) using a while loop ex. 5 raised to the power of 2 .. I am a beginner and i dont know what is the opperand or command i have to use to make this happen..this is what i have so far... echo "Enter a integer for the... (3 Replies)
Discussion started by: jibz
3 Replies

9. HP-UX

Division returning a negative number

Hi All, Just faced an interesting thing in HP-UX. I was dividing 2955334616 / 2 by using echo `expr 2955334616 / 2` , and this ofcourse which expects 1477667308 to be returned. But I am getting -669816340 and I am :wall: how exactly this is possible. It is not one of the compliments (Ones or... (4 Replies)
Discussion started by: mail2sanand
4 Replies

10. Linux

Administrator responsibilities, in case of power outage?

Hi guys, I was wondering if you could share some of your knowledge, in the event of a power outage. Let presume you are on duty and you get a call at midnight because half of your cabinets have no power, air conditioning is down and you deal with a ton of 500 error messages on your boxes. ... (9 Replies)
Discussion started by: TECK
9 Replies

11. UNIX for Advanced & Expert Users

list length

Hello, How can I change this code a=$(egrep "exp" $logFiles -oh); aCount=$(egrep "exp" $logFiles -oh| wc -l); to something like this a=$(egrep "exp" $logFiles -oh); aCount = $a| wc -l What I mean I do not want to execute the egrep twice because it takes a lot of time Regards (6 Replies)
Discussion started by: fdc2suxs
6 Replies

12. UNIX for Dummies Questions & Answers

How to assign echo in variable

I've testing the following code: echo test.txt | cut -d . -f1and get the output "text" So why can't i assign the command to a variable? VAR='"echo test.txt | cut -d . -f1"' echo $VAR (5 Replies)
Discussion started by: jl487
5 Replies

13. Shell Programming and Scripting

error- multiplying negative decimal values

a=10.02 pattern=-11.01 b=$(echo | awk '{ print $a*$pattern}') echo $b its not working even ALso tried `expr $a \* $pattern` No LUCK (3 Replies)
Discussion started by: saluja.deepak
3 Replies

14. UNIX for Dummies Questions & Answers

"echo *.out" - can I separate the results by a new line?

Greetings, Let's say I want to find files matching "*.out" in the current dir. I can do a echo *.out. However, the result is separated by a white space. Is there a way to have the results separated by a new line instead? I know this can be done by using find -maxdepth 1 -name '*.out'. The... (5 Replies)
Discussion started by: rasp
5 Replies

15. Shell Programming and Scripting

Find All duplicates based on multiple keys

Hi All, Input.txt 123,ABC,XYZ1,A01,IND,I68,IND,NN 123,ABC,XYZ1,A01,IND,I67,IND,NN 998,SGR,St,R834,scot,R834,scot,NN 985,SGR0399,St,R180,T15,R180,T1,YY 985,SGR0399,St,R180,T15,R180,T1,NN 985,SGR0399,St,R180,T15,R180,T1,NN 2943,SGR?99,St,R68,Scot,R77,Scot,YY... (2 Replies)
Discussion started by: unme
2 Replies