Name:

max determines which of given constant expressions has maximum value

Usage:

max(expr1,expr2,...,exprn) : (constant, constant, ..., constant) -> constant max(l) : list -> constant

Parameters:

• expr are constant expressions.
• l is a list of constant expressions.

Description:

• max determines which of a given set of constant expressions expr has maximum value. To do so, max tries to increase the precision used for evaluation until it can decide the ordering or some maximum precision is reached. In the latter case, a warning is printed indicating that there might actually be another expression that has a greater value.
• Even though max determines the maximum expression by evaluation, it returns the expression that is maximum as is, i.e. as an expression tree that might be evaluated to any accuracy afterwards.
• max can be given either an arbitrary number of constant expressions in argument or a list of constant expressions. The list however must not be end-elliptic.
• Users should be aware that the behavior of max follows the IEEE 754-2008 standard with respect to NaNs. In particular, a NaN given as the first argument will not be promoted as a result unless the other argument is a NaN. This means that NaNs may seem to disappear during computations.

Example 1:

> max(1,2,3,exp(5),log(0.25));
1.48413159102576603421115580040552279623487667593878e2
> max(17);
17

Example 2:

> l = [|1,2,3,exp(5),log(0.25)|];
> max(l);
1.48413159102576603421115580040552279623487667593878e2

Example 3:

> print(max(exp(17),sin(62)));
exp(17)

Example 4:

> verbosity = 1!;
> print(max(17 + log2(13)/log2(9),17 + log(13)/log(9)));
Warning: maximum computation relies on floating-point result that is faithfully evaluated and different faithful roundings toggle the result.
17 + log2(13) / log2(9)
See also: min, ==, !=, >=, >, <, <=, in, inf, sup
Go back to the list of commands