# routine +^

Documentation for routine `+^`

assembled from the following types:

# language documentation Operators

From Operators

## (Operators) prefix +^

multi sub prefix:<+^>(Any --> Int)

Integer bitwise negation operator: converts the number to binary using as many bytes as needed by the number plus one; flips all bits and returns the result assuming it is a two's complement representation.

say +^255; # OUTPUT: «-256»

In this case, 255 is 11111111 and would need a single byte. We use the representation in bytes needed for this value plus one, converting it to 0000 0000 1111 1111. Bitwise negation turns it into 1111 1111 0000 0000 and this is the representation in two's complement of -256, which is returned.

say +^1; # OUTPUT: «-2»say +^(-256); # OUTPUT: «255»

Negative numbers are assumed to be represented as two's complements, and thus circle back to the original number.

# language documentation Operators

From Operators

## (Operators) infix +^

multi sub infix:<+^>(, --> Int)

Integer bitwise XOR operator: Coerces both arguments to Int and does a bitwise *XOR* (exclusive OR) operation.

say (0b00001101 +^ 0b00001001).base(2); # OUTPUT: «100»