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

The exp (expr) function

The exp(expr) function returns the natural exponential (e^x) of an expression given as an argument. It is also known as base-e exponentiation. The exp (expr) function reports an error if the expression is out of range. The maximum value of the argument supplied to the exp (expr) depends on the computer system's floating-point representation. The following code block shows an example of an exp(expr) function:

$ vi expfunc.awkBEGIN    {    print "exp(1)    = ", exp(1);    print "exp(0)    = ", exp(0);    print "exp(-12)    = ", exp(-12);}$ awk -f expfunc.awk

The output of the execution of the previous code is as follows :

exp(1)    =  2.71828exp(0)    =  1exp(-12)    =  6.14421e-06

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