O'Reilly logo

Learning AWK Programming by Shiwang Kalkhanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary table of built-in arithmetic functions

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()

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required