Skip to content
Advertisement

What is inverse function to XOR?

There is XOR function in Java – a^b

For exemple: 5^3 = 6

Can you tell me inverse function? If I have 6 and 3 can i get range of numbers which include number 5?

Advertisement

Answer

The inverse is XOR!

If you have:

JavaScript

You can get a or b back if you have the other value available:

JavaScript

For example if a = 5, b = 3 (and thus c = 6 as you mentioned) you get:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement