Math doesn't quite add up how I would expect

Hello! I have two values ranging from -180 to 180 (two axes), that I wish to subtract from eachother so i can use the results (to see how much I want to rotate a third, local rather than global axis).
So at the moment I just subtract the two. However, as soon as the second value is in the negative range I get unexpected results.
Instead of getting for instance 175 - 175, it appears to subtract the negative value twice, and I get -350 as a result. I get a comparison rather than a pure subtraction it would appear.

I tried mapping both values to 0-360 instead without luck, as well as using absolute to only only handle positive values. However, I need to be be able to tell how much i need to rotate in negative values as well.

Edit: I just realized I’m going about this the wrong way, but I’m still not sure how to solve it.

The issue appears to be due to the nature of a 360 degree rotation snapping from end of a full rotation to the opposite direction. How do I work around this mathematically?