Function: math.max Stay organized with collections Save and categorize content based on your preferences.
Returns the maximum of two numbers.
If both numbers are integers, returns an integer; otherwise, afloating-point number.
Arguments
| Arguments | |
|---|---|
x | An integer or floating-point number. |
y | An integer or floating-point number. |
Raised exceptions
| Exceptions | |
|---|---|
TypeError | If at least one ofx ory is not an integer or floating-point number. |
Examples
# Return maximum of two numbers# For example, returns `123`-returnStep:return:${math.max(123,-456.7)}
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.