MAX function

Purpose: MAX compares two floating point values and returns the largest one. By default MAX takes doubles as arguments and returns doubles as function results. TO use the MAX function with single floating point and integers, an intermediate variable must be used.


 Syntax:

 RetVal# = MAX(Value1, Value2)

 Parameters:

  • Value1 is a number to be compared to Value2.
  • Value2 is a number to be compared to Value1.

 Return Value:

  • RetVal#, the return value, is the larger of Value1 or Value2.

Example 1:


 PRINT MAX(2.1, 3.2)

Result:

3.2

Example 2:


 DIM RetVal#
 RetVal# = MAX(2.1, 3.2)
 PRINT  RetVal#
 

Result:

3.2

TO use the MAX function with single floating point and integers an intermediate variable must be used. For example, for single floating point maximum value use


 DIM a!, b!, c!
 a! = 2.1
 b! = 3.2
 c! = MAX(a!, b!)
 PRINT c!