dynMax()

Outputs the largest field element.

Synopsis

int dynMax(dyn_int x [, dyn_bool mask]);

uint dynMax(dyn_uint x [, dyn_bool mask]);

float dynMax(dyn_float x [, dyn_bool mask]);

time dynMax(dyn_time x [, dyn_bool mask]);

Parameters

Parameter Meaning
x Dynamic field to be examined
mask Masking field

Return Value

Returns the largest element of the dynamic field x, in the event of errors -1 is returned.

Errors

An error message is issued in the event of missing or incorrect arguments.

Description

With the help of the bit field mask, individual elements of x can be excluded from the calculation. The elements of x and mask are assigned to each other with the same index. If an element of mask corresponds to an element k of the field x, that has the value "false", k is not included in the calculation. If the mask field is shorter than x, all the values of x without an equivalent in mask is included in the calculation. The specification of a mask is optional.

Example

In a dynamic field the largest value is ascertained and a mask is used. 120 is actually the largest, because of the mask the element is "hidden", 6 is returned.

main()
{
  dyn_int di;
  di=makeDynInt(120,1,2,3,4,5,6); // 6 is the largest
  DebugN(dynMax(di, makeDynBool(false))); // Mask!
}

Assignment

Dynamic fields

Availability

CTRL