# Built-in functions

Top: Frida handbook
Previous: Expressions
Next: Curves

The following, outdated list gives an idea of the rich collection of built-in functions that comes with Frida. An up-to-date list of built-in functions can be obtained from the running program by typing hf at the main command.

>  hf
Operators by precedence:
...
Built-in functions:
ln(x): natural logarithm of x, or 0 if x<=0
lg(x): decadic logarithm of x, or 0 if x<=0
sqrt(x): square root of x, or 0 if x<0
abs(x): absolute value of x
exp(x): exponential function of x
sin(x): sine of x (where x in radian)
cos(x): cosine of x (where x in radian)
tan(x): tangent of x (where x in radian)
cot(x): cotangent of x (where x in radian)
sind(x): sine of x (where x in degrees)
cosd(x): cosine of x (where x in degrees)
tand(x): tangent of x (where x in degrees)
cotd(x): cotangent of x (where x in degrees)
asin(x): arc sine of x (result is in radian; return 0 if |x|>1)
acos(x): arc cosine of x (result is in radian; return 0 if |x|>1)
atan(x): arc tangent of x (result is in radian)
acot(x): arc cotangent of x (result is in radian)
asind(x): arc sine of x (result is in degrees; return 0 if |x|>1)
acosd(x): arc cosine of x (result is in degrees; return 0 if |x|>1)
atand(x): arc tangent of x (result is in degrees)
acotd(x): arc cotangent of x (result is in degrees)
sinh(x): hyperbolic sine of x
cosh(x): hyperbolic cosine of x
tanh(x): hyperbolic tangent of x
coth(x): hyperbolic tangent of x
gamma(x): gamma function of x (i.e. factorial of x-1)
erfP(x): ?
erfQ(x): ?
erf(x): error function of x
erfc(x): complementary error function of x
sinc(x): sinus cardinalis, sin(x)/x
ceil(x): the smallest integer i with i>=x
floor(x): the largest integer i with i<=x
nint(x): the integer nearest to x
min(x,y): the smaller of the two arguments x and y
max(x,y): the smaller of the two arguments x and y
ran(x,y): a random number between x and y
kwwc(x,b): (*) Fourier transform \int_0^\infty dq \cos(xq) \exp(q^b)
kwws(x,b): (*) Fourier transform \int_0^\infty dq \sin(xq) \exp(q^b)
(*) For more info on kwwc and kwws, see http://joachimwuttke.de/kww/
gauss(x,s): the normalized Gaussian exp(-x^2/2/s^2)/sqrt(2 pi)/s
gnn(x,s): the unnormalized Gaussian exp(-x^2/2/s^2)
cauchy(x,w): the Cauchy-Lorentz function ?/(x^2+w^2)
q4w(x,y,z): ?
cauchy2(x,y,z): ?
skww(x,y,z): ?
rehavneg(x,y,z): real part of the Havriliak-Negami function
imhavneg(x,y,z): imaginary part of the Havriliak-Negamit function