Hi guys!
first thread in this forum so I apologize if I make any formal errors here
So, my question is whether there is a simpler function to one particular problem:
The function only needs to deal with these four cases and output exactly these outputs:
f( 1, 1) = 1
f( 1, -1) = 1
f(-1, 1) = 1
f(-1, -1) = -1
Only approach I came up with was the function f(a,b) = ((a-1)*(b-1)-2)/-2
But I am in need of a much simpler function. Please help!
first thread in this forum so I apologize if I make any formal errors here

So, my question is whether there is a simpler function to one particular problem:
The function only needs to deal with these four cases and output exactly these outputs:
f( 1, 1) = 1
f( 1, -1) = 1
f(-1, 1) = 1
f(-1, -1) = -1
Only approach I came up with was the function f(a,b) = ((a-1)*(b-1)-2)/-2
But I am in need of a much simpler function. Please help!
Last edited: