# Math::Max
Outputs the maximum value from all block input values
Math::Max
I1
I2
I3
I4
O
# Inputs
| ID | Abbrev | Name | Type | Default | Description |
|---|---|---|---|---|---|
input_1 | I1 | Input #1 | NUMBER | -9223372036854775807 | Input #1 |
input_2 | I2 | Input #2 | NUMBER | -9223372036854775807 | Input #2 |
input_3 | I3 | Input #3 | NUMBER | -9223372036854775807 | Input #3 |
input_4 | I4 | Input #4 | NUMBER | -9223372036854775807 | Input #4 |
# Outputs
| ID | Abbrev | Name | Type | Default | Description |
|---|---|---|---|---|---|
output | O | Output | NUMBER | 0 | Output |
# Source Code
View Volang source
i = 1
empty = -9223372036854775807
max = empty
while (i<=4) {
input = input::get(str::fmt("input_{}", i))
// check if input was provided any value by comparing to a default value of min(i64)
hasValue = input != empty
if (hasValue) {
if (input > max or max == empty) {
max = input
}
}
i += 1
}
fn round2decimal(value) {
return math::round(100.0 * value) / 100.0
}
output::set("output", round2decimal(max))
