max()
Math / CalculationDescription
Determines the largest value in a sequence of numbers. Supports two or three arguments.
Syntax
float max(float a, float b)
float max(float a, float b, float c)
Parameters
| Name | Type | Description |
|---|---|---|
| a | float | first value |
| b | float | second value |
| c | float | third value (optional) |
Returns
floatRelated
Under the Hood
From Processing.h:
int max() const {
if (data.empty()) throw std::runtime_error("Cannot use max() on an empty IntList.");
return *std::max_element(data.begin(), data.end());
}
float max() const {
if (data.empty()) throw std::runtime_error("Cannot use max() on an empty FloatList.");
return *std::max_element(data.begin(), data.end());
}
static float max(float a,float b) { return a>b?a:b; }
static float max(float a,float b,float c) { float m=a>b?a:b; return m>c?m:c; }
Under the Hood
From Processing.cpp:
return max(r, max(g, b)) * colorMaxB;