Skip to main content

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.

ArgumentTypeRequirementDescription
aFloatRequired, positionalReturned when the two are equal.
bFloatRequired, positionalReturned 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.

ArgumentTypeRequirementDescription
aFloatRequired, positionalReturned when it is smaller.
bFloatRequired, positionalReturned 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.

ArgumentTypeRequirementDescription
aIntRequired, positionalFirst value.
bIntRequired, positionalSecond value.

Returns Int. The larger value.

min_int​

min_int(a: Int, b: Int) -> Int

Returns the smaller of two integers.

ArgumentTypeRequirementDescription
aIntRequired, positionalFirst value.
bIntRequired, positionalSecond value.

Returns Int. The smaller value.