What is the output of the function above?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
2 x + y is the average of the numbers x and y . Geometrically, this is the point that is halfway between x and y ;
∣ x − y ∣ is the difference beteeen x and y . 2 ∣ x − y ∣ is half of this distance. Geometrically, if we add this to the average of x and y , we will end up whichever is the highest: x or y .
Extension
How could you alter the function to output the lower of the two inputs?