Top | Up (Math) | < Previous (MIN) | Next (SQR) >
Finds the largest number in a list of numbers or an array
MAX number_1, number_2 [, ...] OUT maximum
MAX array[] OUT maximum
Parameter | Description |
---|---|
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 |
Output | Description |
maximum | The 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. |
PRINT MAX(7,4,8) '8
DIM A[3]
A[0]=7
A[1]=4
A[2]=8
PRINT MAX(A) '8
Error | Cause |
---|---|
Type mismatch | The list of numbers has fewer than 2 items, or a value which isn’t a number, or a string array was used. |
Illegal function call | 0 arguments were passed, or the number of outputs was not 1, or an array with a length of 0 was used. |
No longer allows arrays with 0 elements 1
Now treats NaN properly (MAX returns NaN if any of the inputs are NaN) 2
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/