Math built-ins
These pick one of two numbers without opening a scope, so they suit inner loops. std::max and std::min wrap the Float versions.
max_float
max_float(a: Float, b: Float) -> Float
Returns the larger of two floats.
| Argument | Type | Requirement | Description |
|---|---|---|---|
a | Float | Required, positional | Returned when the two are equal. |
b | Float | Required, positional | Returned when it is larger. |
Returns Float. b if a is less than b, otherwise a.
Like a comparison, it compares values snapped to the manufacturing grid, and waits until the solver has fixed both.
min_float
min_float(a: Float, b: Float) -> Float
Returns the smaller of two floats.
| Argument | Type | Requirement | Description |
|---|---|---|---|
a | Float | Required, positional | Returned when it is smaller. |
b | Float | Required, positional | Returned when the two are equal. |
Returns Float. a if a is less than b, otherwise b.
max_int
max_int(a: Int, b: Int) -> Int
Returns the larger of two integers.
| Argument | Type | Requirement | Description |
|---|---|---|---|
a | Int | Required, positional | First value. |
b | Int | Required, positional | Second value. |
Returns Int. The larger value.
min_int
min_int(a: Int, b: Int) -> Int
Returns the smaller of two integers.
| Argument | Type | Requirement | Description |
|---|---|---|---|
a | Int | Required, positional | First value. |
b | Int | Required, positional | Second value. |
Returns Int. The smaller value.