middle

num middle(num a, num b, num c)

num - any numeric type (int or fixed)

Description

Out of three numbers, returns the one that is between the other two.

The order of the arguments doesn't matter.

If two arguments are equal, their value is returned.

Examples

middle(1, 2, 3) -> 2
middle(2, 1, 3) -> 2
middle(3, 1, 2) -> 2
middle(0.1, 0.2, 0.3) -> 0.2
middle(0.1, 0.3, 0.2) -> 0.2
middle(0.2, 0.3, 0.1) -> 0.2