Here is how one can mathematically find the minimum and maximum of a set of two rational numbers. Whether you are programming something in a language that doesn’t have built in Min(...) and Max(...) such as VBScript (and choose not to use IF...ELSE) or you are simply curious on how minimum and maximum of two numbers can be calculated mathematically, here is something you may find useful. I can’t remember where exactly I learned this but I do know it was some time back in junior Comp. Sci. therefore remember that I didn’t come up with this myself.

Mathematical definition of Minimum and Maximum

Mathematical definition of Minimum and Maximum

You want to see this work? Well here are some examples.

Example calculation of minimum and maximum of two numbers

Example calculation of minimum and maximum of two numbers