`abs`

,
`atan`

,
`ceiling`

,
`cos`

,
`exp`

,
`float`

,
`floor`

,
`log`

,
`round`

,
`sign`

,
`sin`

,
`sqrt`

,
`tan`

,
`truncate`

Function | Meaning |

`abs(Exp)` | absolute value of Exp : i.e. Exp if Exp ≥ 0, –Exp if Exp < 0 |

`atan(Exp)` | arctangent (inverse tangent) of Exp : result is in radians |

`cos(Exp)` | cosine of the Exp : Exp is in radians |

`exp(Exp)` | e^{Exp} : e is 2.71828182845… |

`log(Exp)` | natural logarithm of Exp : i.e. logarithm to the base* e |

`sin(Exp)` | sine of the Exp : Exp is in radians |

`sqrt(Exp)` | square root of the Exp |

`tan(Exp)` | tangent of the Exp: Exp is in radians |

`sign(Exp)` | sign (+1 or –1) of the Exp: sign(–3) = –1 = sign(–3.7) |

`float(Exp)` | float of the Exp: float(22) = 22.0 -
see also `float` the predicate |

`floor(Exp)` | largest integer ≤ Exp: floor(1.66) = 1 |

`truncate(Exp)` | remove fractional part of Exp: truncate(–1.5) = –1, truncate(1.5) = 1 |

`round(Exp)` | round Exp to nearest integer: round(1.6) = 2, round(1.3) = 1 |

`ceiling(Exp)` | smallest integer ≥ Exp: ceiling(1.3) = 2 |

These functions should be used in a context where they will actually
be evaluated, such as following `is`

or as part of an arithmetic comparison
operator like `=:=`

or `>`

.

Example:

?- X is sqrt(2). X = 1.41421Compare this with the following, where sqrt(2) is not evaluated, because

`=`

does not evaluate its arguments.
?- X = sqrt(2). X = sqrt(2)Another example:

?- X is log(3+2). X = 1.60944.

These mathematical functions may correspond to arity 2 built-in predicates: for example, one can do this:

?- sqrt(2, X). X = 1.41421Some versions of SWI Prolog (e.g. 5.6.47) implement many of these arity 2 predicates, but not e.g.

`exp/2`

.
* High School Maths Reminder Service: if you want the logarithm to base *a*,
divide log(Exp) by log(*a*). E.g. log_{10}(X) =
log(X)/log(10), and log_{2}(X) = log(X)/log(2).