Module ce_math

Mathematics and arithmetic library.

Description

Mathematics and arithmetic library.

Function Index

base/2Formats an integer into a string in base N, or parses a string in base N into an integer.
ceil/1Returns the next highest integer of a value.
ceil/2Returns the next highest multiple of N.
deg_to_rad/1Converts degrees to radians.
fact/1Returns the factorial of the given integer.
fib/1Returns the nth term in the Fibonacci squence [1,1,2,3,5,8,13...]
fix/1Returns the next lowest integer to the given number.
floor/1Equivalent to fix(number()).
gcf/2Computes the greatest common factor of two integers.
lcm/2Computes the least common multiple of two integers.
max/2Returns the greater of two values.
min/2Returns the lesser of two values.
rad_to_deg/1Converts radians to degrees.
sgn/1Returns +1, 0, or -1, depending on the argument's sign.

Function Details

base/2

base(Base::integer(), Value::integer() | string()) -> string() | integer()

Formats an integer into a string in base N, or parses a string in base N into an integer. Throws an error if the given string is not a well-formed number in base N.

ceil/1

ceil(X::number()) -> integer()

Returns the next highest integer of a value. Complements trunc.

ceil/2

ceil(X::number(), N::number()) -> number()

Returns the next highest multiple of N.

deg_to_rad/1

deg_to_rad(X::number()) -> number()

Converts degrees to radians.

fact/1

fact(N::integer()) -> integer()

Returns the factorial of the given integer.

fib/1

fib(N::integer()) -> integer()

Returns the nth term in the Fibonacci squence [1,1,2,3,5,8,13...]

fix/1

fix(X::number()) -> integer()

Returns the next lowest integer to the given number.

floor/1

floor(X::number()) -> integer()

Equivalent to fix(number()).

gcf/2

gcf(M::integer(), N::integer()) -> integer()

Computes the greatest common factor of two integers. This code was borrowed from Scott Gasch (who borrowed it from Euclid) and translated into Erlang.

lcm/2

lcm(I::integer(), J::integer()) -> integer()

Computes the least common multiple of two integers.

max/2

max(X::term(), Y::term()) -> term()

Returns the greater of two values.

min/2

min(X::term(), Y::term()) -> term()

Returns the lesser of two values.

rad_to_deg/1

rad_to_deg(X::number()) -> number()

Converts radians to degrees.

sgn/1

sgn(N::number()) -> integer()

Returns +1, 0, or -1, depending on the argument's sign.


Generated by EDoc, Dec 25 2007, 02:37:37.