Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Latest commit

 

History

History
88 lines (75 loc) · 2.88 KB

MAX.org

File metadata and controls

88 lines (75 loc) · 2.88 KB

Top | Up (Math) | < Previous (MIN) | Next (SQR) >

MAX

Finds the largest number in a list of numbers or an array

Syntax

MAX number_1, number_2 [, ...] OUT ma​ximum
MAX array[] OUT maxim​um
ParameterDescription
number_1, number_2, …List of numbers to find the maximum of. Must have at least 2 numbers
array[]Number array to find the maximum of. Length must not be 0
OutputDescription
maximumThe maximum of the list/array. Will always be a float, unless you passed an integer array or 2 integers. If the maximum value occurs multiple times in the list, MAX returns the first occurrence.

Examples

PRINT MAX(7,4,8) '8
DIM A[3]
A[0]=7
A[1]=4
A[2]=8
PRINT MAX(A) '8

Possible Errors

ErrorCause
Type mismatchThe list of numbers has fewer than 2 items, or a value which isn’t a number, or a string array was used.
Illegal function call0 arguments were passed, or the number of outputs was not 1, or an array with a length of 0 was used.

Version Information

3.3.2

No longer allows arrays with 0 elements 1

3.6.0

Now treats NaN properly (MAX returns NaN if any of the inputs are NaN) 2

References

1 SmileBoom “Bug Fixes in Ver. 3.3.2 (August 10, 2016)” http://smilebasic.com/en/debug/archive/
2 SmileBoom “Bug Fixes in Ver. 3.6.0 (June 29, 2018)” http://smilebasic.com/en/debug/


Top | Up (Math) | < Previous (MIN) | Next (SQR) >