# Math

When building your backend application, the likelihood of you needing to work with and transform numbers is very high. That's why Xano has a series of Math functions and filters that allow you to do whatever you want.

### Examples

For each of these examples, we will Create a variable number with the value of **5.**

**Add Number**
Add a number to an existing variable.

In the above example, the `number`

variable would be **15**

**Subtract Number**
Subtract a number from an existing variable.

In the above example, the `number`

variable would be **2**

**Multiply Number**
Multiply a number by an existing variable.

In the above example, the `number`

variable would be **60**

**Divide Number**
Divide an existing variable by a number.

In the above example, the `number`

variable would be **1**

**Modulus Number**
Get the remainder when an existing variable is divided by a number.

In the above example, the `number`

variable would be **1**

**Bitwise Operators**
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.

We all know that 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)

**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:

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

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

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:

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

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

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:

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

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

In the above example, the `number`

variable would be **21**

Last updated