> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Math

For each of these examples, we'll start with a value of 5.

<Frame>
  <iframe src="https://demo.arcade.software/V97HHLB4uaJpfBmFNi2w?embed" title="https://demo.arcade.software/V97HHLB4uaJpfBmFNi2w?embed" allowFullScreen allow="clipboard-write" class="contentkit-webframe" width="1000" height="500" />
</Frame>

### Add Number

Adds one value to another

### Subtract Number

Subtracts one value from another

### Multiply Number

Multiplies one value by another

### Divide Number

Divides one value by another

### Modulus Number

Get the remainder when an existing value is divided by a number.

### Bitwise

Working on bytes, or Data Types comprising of bytes like ints, floats, doubles or even data structures that store large amounts of bytes is normal for a programmer. In some cases, a programmer needs to go beyond this - that is to say, on a deeper level where the importance of bits is realized.

Operations with bits are used in **Data Compression** (data is compressed by converting it from one representation to another, to reduce the space), **Exclusive-Or Encryption** (an algorithm to encrypt the data for safety issues). In order to encode, decode, or compress files we have to extract the data at bit level. Bitwise Operations are faster and closer to the system and sometimes optimize the program to a good level.

1 byte comprises of 8 bits and any integer or character can be represented using bits in computers, which we call its binary form(contains only 1 or 0) or in its base 2 form. [Real-world use cases of Bitwise Operators (Stack Overflow)](https://stackoverflow.com/questions/2096916/real-world-use-cases-of-bitwise-operators)

**Bitwise AND**

The output of bitwise AND is 1 if the corresponding bits of two operands is 1. If either bit of an operand is 0, the result of the corresponding bit is evaluated to 0. Here's an example with the binary values written out:

```csharp theme={null}
12 = 00001100 (In Binary)
25 = 00011001 (In Binary)

Bit Operation of 12 and 25
  00001100
& 00011001
  ________
  00001000  = 8 (In decimal)
```

We will set up the same example in **Xano** and change the number variable to 12.

<Frame>
  <img src="https://mintcdn.com/xano-997cb9ee/Zmn_DUDgqMkazo6J/images/e576db9f-image.jpeg?fit=max&auto=format&n=Zmn_DUDgqMkazo6J&q=85&s=30dbaaa3f60684a0eb865dcc7b1d3260" width="1066" height="594" data-path="images/e576db9f-image.jpeg" />
</Frame>

And for the API action we will use Bitwise AND with the value 25:

<Frame>
  <img src="https://mintcdn.com/xano-997cb9ee/WBQXG-4Ngk82eYAW/images/fb3ded4a-image.jpeg?fit=max&auto=format&n=WBQXG-4Ngk82eYAW&q=85&s=765269b0e16e7787c69ccbdaa653c6e2" width="1060" height="558" data-path="images/fb3ded4a-image.jpeg" />
</Frame>

In the above example, the `number` variable would be **8**

**Bitwise OR**

The output of bitwise OR is 1 if at least one corresponding bit of two operands is 1. In C Programming, bitwise OR operator is denoted by |. Here's an example with the binary values written out:

```csharp theme={null}
12 = 00001100 (In Binary)
25 = 00011001 (In Binary)

Bitwise OR Operation of 12 and 25
  00001100
| 00011001
  ________
  00011101  = 29 (In decimal)
```

We will set up the same example in **Xano** and change the number variable to 12.

<Frame>
  <img src="https://mintcdn.com/xano-997cb9ee/Zmn_DUDgqMkazo6J/images/e576db9f-image.jpeg?fit=max&auto=format&n=Zmn_DUDgqMkazo6J&q=85&s=30dbaaa3f60684a0eb865dcc7b1d3260" width="1066" height="594" data-path="images/e576db9f-image.jpeg" />
</Frame>

And for the API action we will use Bitwise OR with the value 25:

<Frame>
  <img src="https://mintcdn.com/xano-997cb9ee/ClU5W_-qt6GI3QWZ/images/4214fb9e-image.jpeg?fit=max&auto=format&n=ClU5W_-qt6GI3QWZ&q=85&s=2a4d9f7ba4f1bf58df3c6acabf0d35dc" width="1064" height="578" data-path="images/4214fb9e-image.jpeg" />
</Frame>

In the above example, the `number` variable would be **29**

**Bitwise XOR**

The result of bitwise XOR operator is 1 if the corresponding bits of two operands are opposite. It is denoted by ^. The exclusive-or operation takes two inputs and returns a 1 if either one or the other of the inputs is a 1, but not if both are. That is, if both inputs are 1 or both inputs are 0, it returns 0. Bitwise exclusive-or, with the operator of a caret, ^, performs the exclusive-or operation on each pair of bits. Exclusive-or is commonly abbreviated XOR. Here's an example with the binary values written out:

```csharp theme={null}
12 = 00001100 (In Binary)
25 = 00011001 (In Binary)

Bitwise XOR Operation of 12 and 25
  00001100
^ 00011001
  ________
  00010101  = 21 (In decimal)
```

We will set up the same example in **Xano** and change the number variable to 12.

<Frame>
  <img src="https://mintcdn.com/xano-997cb9ee/Zmn_DUDgqMkazo6J/images/e576db9f-image.jpeg?fit=max&auto=format&n=Zmn_DUDgqMkazo6J&q=85&s=30dbaaa3f60684a0eb865dcc7b1d3260" width="1066" height="594" data-path="images/e576db9f-image.jpeg" />
</Frame>

And for the API action we will use Bitwise XOR with the value 25:

<Frame>
  <img src="https://mintcdn.com/xano-997cb9ee/_FyaEhYRFYQZinJ0/images/db3d3b28-image.jpeg?fit=max&auto=format&n=_FyaEhYRFYQZinJ0&q=85&s=19f4c0290c507bab4d3dd0ac31d28382" width="1064" height="578" data-path="images/db3d3b28-image.jpeg" />
</Frame>

In the above example, the `number` variable would be **21**
