The following table summarizes the different built-in arithmetic functions available in AWK:
Function |
Value returned |
sin(x) |
Returns the sine of x, with x in radians |
cos(x) |
Returns the cosine of x, with x in radians |
atan2(x,y) |
Returns the arc tangent of x/y in the range of -22/7 to +22/7 |
int(x) |
Returns the integer part of x, truncated towards 0 |
log(x) |
Returns the natural (base-e) logarithm of x |
exp(x) |
Returns e to the power of x , e^x |
sqrt(x) |
Returns the square root of x |
rand() |
Generates the random number x, where 0 <= x < 1 |
srand() |
X is the new seed value for rand() |