-
abs (object)
returns absolute value of a
Params:
Description:
may be applied to an atom or to all elements of a sequence
Example:
x = abs({10.5, -12, 3})
x is {10.5, 12, 3}
i = abs(-4)
i is 4
See also:
sign()
-
sign (object)
returns sign of a
Params:
Description:
may be applied to an atom or to all elements of a sequence.
Example:
i = sign(5)
i is 1
i = sign(0)
i is 0
i = sign(-2)
i is -1
See also:
abs(), compare()
-
max (object)
returns maximal value of a
Params:
Description:
may be applied to an atom or to a sequence
Return:
object
Example:
a = max({10,15.4,3})
a is 15.4
See also:
min()
-
min (object)
returns minimal value of a
Params:
Description:
may be applied to an atom or to a sequence
Return:
object
Example:
a = min({10,15.4,3})
a is 3
See also:
max()
-
is_in_range (atom, atom, atom)
checks if item fills in a range
Params:
-
atom item
item to check
-
atom from
minimal value
-
atom upto
maximal value
Return:
1 if within range, 0 if not
Example:
i = is_in_range(3.14, 3, 4)
i is 1
i = is_in_range(3.14, 2, 3)
i is 0
-
mod (integer, integer)
returns remainder of a division using floored division
Params:
-
integer x
dividend
-
integer y
divisor
Description:
when the operands' signs are different rounds dividend/divisor away from zero
whereas remainder() rounds towards zero.
Return:
object: remainder of the division
Example:
a = mod(9, 4)
a is 1
s = mod({81, -3.5, -9, 5.5}, {8, -1.7, 2, -4})
s is {1,-0.1,1,-2.5}
s = mod({17, 12, 34}, 16)
s is {1, 12, 2}
s = mod(16, {2, 3, 5})
s is {0, 1, 1}
-
trunc (object)
returns integer part of an object
Params:
Description:
may be applied to an atom or to a sequence
Example:
a = trunc(9.4)
a is 9
s = trunc({81, -3.5, -9.999, 5.5})
s is {81,-3, -9, 5}
See also:
frac()
-
frac (object)
returns fractional part of an object
Params:
Description:
may be applied to an atom or to a sequence
Example:
a = frac(9.4)
a is 0.4
s = frac({81, -3.5, -9.999, 5.5})
s is {0, -0.5, -0.999, 0.5}
See also:
trunc()
-
ceil (object)
Params:
Description:
may be applied to an atom or to a sequence
Example:
i = ceil(15.2)
i is 16
s = ceil({3.14, 1.72})
s is {4, 2}
See also:
floor()
-
intdiv (integer, integer)
returns result of an integer division
Params:
-
integer a
dividend
-
integer b
divisor
Description:
may be applied to an atom or to a sequence
Example:
a = intdiv(9, 4)
a is 3
s = intdiv({81, -3.5, -9, 5.5}, {8, -1.7, 2, -4})
s is {11,-3,-5,2}
s = intdiv({17, 12, 34}, 16)
s is {2,1,3}
s = intdiv(16, {2, 3, 5})
s is {8,6,4}
See also:
remainder(), mod()
-
round (object, sequence)
rounds an object to a specified precision
Params:
-
object a
-
sequence optional
Description:
may be applied to an atom or to a sequence
Example:
round(5.2, {})
5
round({4.12, 4.67, -5.8, -5.21}, {{"precision",10}})
{4.1, 4.7, -5.8, -5.2}
round(12.2512, {{"precision",100}})
12.25
-
rad2deg (object)
Convert an angle measured in radians to an angle measured in degrees
Params:
Description:
may be applied to an atom or to a sequence
Example:
x = rad2deg(3.385938749)
x is 194
-
deg2rad (object)
Convert an angle measured in degrees to an angle measured in radians
Params:
Description:
may be applied to an atom or to a sequence
Example:
x = deg2rad(194)
x is 3.385938749
-
log10 (object)
base 10 logarithm of a number.
Params:
Description:
may be applied to an atom or to a sequence
Example:
a = log10(12)
a is 1.079181246 (use pretty_print instead of printf to get more digits)
s = log10({12, 15})
s is {1.079181246, 1.176091259}
-
exp (atom)
Computes some power of E.
Params:
Description:
may be applied to an atom or to a sequence
Example:
x = exp(5.4)
x is 221.4064162
s =exp({1, 5.4}), {0})
s is {2.718281828, 221.4064162}
-
fib (integer)
Computes the Fibonacci Number of the given value
Params:
Description:
fib(0) = 0
fib(1) = 1
fib(n+2) = fib(n+1) + fib(n) if n > 1
Example:
i = fib(6)
i is 8
-
cosh (object)
hyperbolic cosine of an object.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? cosh(LN2) -- prints out 1.25--
See also:
sinh(), arccosh()
-
sinh (object)
hyperbolic sine of an object.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? sinh(LN2) -- prints out 0.75
See also:
cosh(), arcsinh()
-
tanh (object)
hyperbolic tangent of an object.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? tanh(LN2) -- prints out 0.6
See also:
cosh(), sinh(), arctanh()
-
arcsinh (object)
reverse hyperbolic sine of an object.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? arcsinh(1) -- prints out 0.881373587
-
arccosh (not_below_1)
reverse hyperbolic cosine of an object.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? arccosh(1) -- prints out 0
See also:
arcsinh(), cosh()
-
arctanh (abs_below_1)
reverse hyperbolic tangent of an object.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? arctanh(1/2) -- prints out 0.5493061443
See also:
arcsinh(), cosh()
-
sum (object)
sum of all atoms in the argument.
Params:
Description:
may be applied to an atom or to a sequence
Example:
a = sum({10, 20, 30})
a is 60
a = sum({10.5, {11.2} , 8.1})
a is 29.8
See also:
product()
-
product (object)
product of all the atom in the argument.
Params:
Description:
may be applied to an atom or to a sequence
Example:
a = product({10, 20, 30})
a is 6000
a = product({10.5, {11.2} , 8.1})
a is 952.56
See also:
sum()
-
gcd (atom, atom)
greater common divisor of to atoms
Params:
Description:
largest value that evenly divides into both parameters
zero is ignored
Example:
? gcd(76.3, -114) --> 38
? gcd(0, -114) --> 114
? gcd(0, 0) --> 0 (This is often regarded as an error condition)
-
approx (object, object, sequence)
Compares two (sets of) numbers based on approximate equality.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? approx(10, 33.33 * 30.01 / 100, {})
prints 0 because 10 and 10.002333 are within 0.005 of each other
? approx(10, 10.001, {})
prints 0 because 10 and 10.001 are within 0.005 of each other
? approx(10, {10.001,9.999, 9.98, 10.04}, {})
prints {0,0,1,-1}
? approx({10.001,9.999, 9.98, 10.04}, 10, {})
prints {0,0,-1,1}
? approx({10.001,{9.999, 10.01}, 9.98, 10.04}, {10.01,9.99, 9.8, 10.4}, {})
prints {-1,{1,1},1,-1}
? approx(23, 32, {{"epsilon",10}})
prints 0 because 23 and 32 are within 10 of each other
-
is_powerof2 (object)
checks if object is power of 2
Params:
Description:
may be applied to an atom or to a sequence
Example:
for i = 1 to 5 do
? {i, powof2(i)}
end for
output ...
{1,1}
{2,1}
{3,0}
{4,1}
{5,0}
-
is_even (object)
Test if the supplied Euphoria object is even.
Params:
Description:
may be applied to an atom or to a sequence
Example:
? is_even(2) --> 1
? is_even(1) --> 0
? is_even(-2) --> 1
? is_even(-1) --> 0
? is_even({-1,0,2}) --> {0, 1, 1}
? is_even(3.4) --> 0
? is_even({{1,2,3}, {{4,5},6,{7,8}},9}) --> {{0,1,0},{{1,0},1,{0,1}},0}