fmax(Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function will return the largest of the two provided values.

 

Note: This function works with DOUBLE, but can also work with FLOAT as described in the Floating-point math introductory section.

 

Input:

A : DOUBLE

Value to compare.

B : DOUBLE

Value to compare.

 

Returns: DOUBLE

The largest argument.

 

Declaration:

FUNCTION fmax : DOUBLE;
VAR_INPUT
a : DOUBLE;
b : DOUBLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
 
DebugFmt(message := "min: " + doubleToStr(v:= fmin(a := 1.0, b := 1.0001)));
DebugFmt(message := "max: " + doubleToStr(v:= fmax(a := 1.0, b := 1.0001)));
 
END_PROGRAM;