9.31.7 Math Builtins
The following built-in functions may be used to generate a
floating-point value. All return a floating-point value except
$cvi, $int, and $sgn, which return an integer
value.
-
$acos(
expr
)
- Returns the floating point arccosine of expr.
-
$asin(
expr
)
- Returns the floating point arcsine of expr.
-
$atan(
expr
)
- Returns the floating point arctangent of expr.
-
$atan2(
expr1
,
expr2
)
- Returns the floating point arctangent of expr1 / expr2.
-
$ceil(
expr
)
- Returns the smallest integer not less than expr as floating point.
-
$cosh(
expr
)
- Returns the floating point hyperbolic cosine of expr.
-
$cos(
expr
)
- Returns the floating point cosine of expr.
-
$cvf(
expr
)
- Returns the integer value expr converted to floating-point.
-
$cvi(
expr
)
- Returns the floating point value expr converted to integer.
-
$exp(
expr
)
- Returns the floating point value e ^ expr.
-
$fabs(
expr
)
- Returns the floating point absolute value of expr.
-
$floor(
expr
)
- Returns the largest integer that is not greater than expr as
floating point.
-
$fmod(
expr1
,
expr2
)
- Returns the floating point remainder of expr1 / expr2.
-
$int(
expr
)
- Returns 1 if expr evaluates to an integer, zero otherwise.
-
$ldexp(
expr1
,
expr2
)
- Returns the floating point value expr1 * 2 ^ expr2.
-
$log10(
expr
)
- Returns the base 10 logarithm of expr.
-
$log(
expr
)
- Returns the natural logarithm of expr.
-
$max(
expr1
,
expr2
)
- Returns the floating point maximum of expr1 and expr2.
-
$min(
expr1
,
expr2
)
- Returns the floating point minimum of expr1 and expr2.
-
$pow(
expr1
,
expr2
)
- Returns the floating point value expr1 ^ expr2.
-
$round(
expr
)
- Returns the nearest integer to expr as a floating point number.
-
$sgn(
expr
)
- Returns -1, 0, or 1 based on the sign of expr.
-
$sin(
expr
)
- Returns the floating point sine of expr.
-
$sinh(
expr
)
- Returns the floating point hyperbolic sine of expr.
-
$sqrt(
expr
)
- Returns the floating point square root of expr.
-
$tan(
expr
)
- Returns the floating point tangent of expr.
-
$tanh(
expr
)
- Returns the floating point hyperbolic tangent of expr.
-
$trunc(
expr
)
- Returns the integer value of expr truncated towards zero as
floating point.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.