4

I have 2 variables, x and y.

I am doing z = x^y.

Now assuming I know only z and y, How can I get x back? Is there an opposite to ^ in JavaScript?

shannoga
  • 19,649
  • 20
  • 104
  • 169
  • Try this at http://stackoverflow.com/questions/4540422/why-is-there-no-logical-xor-in-javascript/18064899#18064899 – asiby Aug 05 '13 at 20:54

2 Answers2

17

Yes, ^ is its own inverse.

x == (x^y)^y
Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
0

Given z=x^y

You can get x by doing x=z^y

Siegen
  • 943
  • 10
  • 13