I'm working on an application which has a specific function which receives 2 ints: x and y. If y > x then I would like the function to return y otherwise return x - y. Just a few examples:
- f(10, 12) => 12
- f(9, 9) => 0
- f(11, 3) => 8
I can easily do this using ifs etc but I was just wondering if it's possible to write it using mathematics only? to be more precise what I'm asking is: is it possible to write that function as a computer function only using mathematical operands? (no ifs or any other conditionals)?
It's not any kind of homework, just pure curiousity
I was even struggling with giving it the right tags since I have no idea to what topic this issue belongs to
Thanks in advance