What does a double caret in Sage do?

Sage math uses a single caret (^) for exponentiation, unlike Python which uses it for XOR.

I'm studying a file crypto.sage which has a double caret:

 assert p^^q == x

What does that do?


Solution 1:

This is the bitwise xor operator like ^ in python:

# Sage
sage: 3^^2
1

# Python
>>> 3^2
1

For exponentiation:

# Sage
sage: 2^8
256

# Python
>>> 2**8
256
Sage Python
Exponential ^ **
Bitwise XOR ^^ ^