Xano Documentation
Search…
⌃K

Math Filters

Math filters are various operations in Xano to perform math and calculations. Like all filters you can chain math filters together and nest them inside one another to perform order of operations.
  • abs - Returns the absolute.
  • acos - Calculates the arc cosine of the supplied value in radians.
  • acosh - Calculates the inverse hyperbolic cosine of the supplied value in radians.
  • add - Add 2 values together and return the answer
  • asin - Calculates the arc sine of the supplied value in radians..
  • asinh - Calculates the inverse hyperbolic sine of the supplied value in radians.
  • atan - Calculates the arc tangent of the supplied value in radians.
  • atanh - Calculates the inverse hyperbolic tangent of the supplied value in radians.
  • bitwise_and - Bitwise AND 2 values together and return the answer.
  • bitwise_or - Bitwise OR 2 values together and return the answer.
  • bitwise_xor - Bitwise XOR 2 values together and return the answer.
  • ceil - Round a decimal up to its integer equivalent.
  • cos - Calculates the cosine of the supplied value in radians.
  • deg2rad - Convert degrees to radians.
  • divide - Divide 2 values together and return the answer.
  • exp - Returns the exponent of mathematical expression "e".
  • floor - Round a decimal down to its integer equivalent.
  • max - Returns the max of the values of the array.
  • min - Returns the min of the values of the array.
  • modulus- Modulus 2 values together and return the answer.
  • multiply - Multiply 2 values together and return the answer.
  • number_format - Format a number with flexible support over decimal places, thousands separator, and decimal separator.
  • pow - Returns the value raised to the power of exp.
  • product - Returns the product of the values of the array.
  • rad2deg - Convert radians to degrees.
  • round - Round a decimal with optional precision.
  • sin - Calculates the sine of the supplied value in radians.
  • sqrt - Returns the square root of the value
  • subtract - Subtract 2 values together and return the answer.
  • sum - Returns the sum of the values of the array.
  • tan - Calculates the tangent of the supplied value in radians.

abs:

Returns the absolute value. The absolute value of the number is the positive equivalent, -3 becomes 3.
In this example, the filter changes the value -1232.4242 to 1232.4242

acos:

Calculates the arc cosine of the supplied value in radians.
For example the arc cosine of -1 is π or 3.14159.

acosh:

Calculates the inverse hyperbolic cosine of the supplied value in radians.

add:

Adds 2 values together and returns the answer.
In this example, the filter adds 4 to 3 and the variable "add" becomes 7.

asin:

Calculates the arc sine of the supplied value in radians.

asinh:

Calculates the inverse hyperbolic sine of the supplied value in radians.

atan:

Calculates the arc tangent of the supplied value in radians.

atanh:

Calculates the inverse hyperbolic tangent of the supplied value in radians.

Bitwise Operators:

Working on bytes, or Data Types comprising of bytes like ints, floats, doubles or even data structures which 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.

Bitwise_and:

Bitwise AND 2 values together and return the answer 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:
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. We will add the filter bitwise_and with the value 25:
The variable value becomes: 8

Bitwise_or:

Bitwise OR 2 values together and return the answer 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:
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. We will add the filter Bitwise_OR with the value 25:
The variable number becomes: 29

Bitwise_xor:

Bitwise XOR 2 values together and return the answer 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:
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. We will add the filter Bitwise_xor with the value 25:
The variable number becomes: 21

ceil:

Round fractions up to their integer equivalent.
The variable number becomes: 6

cos:

Calculates the cosine of the supplied value in radians

deg2rad:

Convert degrees to radians

divide:

Divides 2 values together and returns the answer.
In this example, the filter changes the integer 25 to 5.

exp:

Returns the exponent of mathematical expression "e".
In this example the filter returns the value as 20.085536923187668

floor:

Round fractions down to their integer equivalent.
In this example, the filter changes the decimal 7.3 to 7.

modulus:

Modulus 2 values together and return the answer The modulus (or "modulo" or "mod") is the remainder after dividing one number by another.
In this example, the filter changes the decimal 25 to 12.

multiply:

Multiplies 2 values together and returns the answer.
In this example, the filter changes the integer 25 to 250.

number_format:

Format a number with flexible support over decimal places, thousands separator, and decimal separator.
In this example, the number will be formatted to 4,999.

pow:

Returns the value raised to the power of the exponent.
In this example, the filter changes the integer to 64.

rad2deg:

Convert radians to degrees

round:

Round fractions their integer equivalent.
In this example, the filter changes the decimal from 6.8 to 7.

sin:

Calculates the sine of the supplied value in radians

sqrt:

Returns the square root of the value
In this example, the filter changes the integer to 2subtract:

subtract:

Subtracts 2 values together and returns the answer.
In this example, the filter changes the integer 15 to 10.

tan:

Calculates the tangent of the supplied value in radians

Special Array Math Filters:

Max:

Returns the max of the values of the array. In this example, the variable array is [ 1, 2, 3, 4, 5].
In this example, the variable Array_max becomes 5.

Min:

Returns the min of the values of the array. In this example, the variable array is [ 1, 2, 3, 4, 5].
In this example, the variable Array_min becomes 1.

Product:

Returns the product of the values of the array. In this example, the variable array is [ 1, 2, 3, 4, 5].
In this example, the variable product becomes 120.

Sum:

Returns the sum of the values of the array. In this example, the variable array is [ 1, 2, 3, 4, 5].
In this example, the variable product becomes 15.