Math functions

Math function

abs() | ceil() | customizable_round_multiply() | customizable_round_division() | exp() | fac() | floor() | int() | int_to_string() | is_float() | is_int() | log() | max() | md5() | min() | pow() | random() | round() | sha1() | sha256() | sqrt() | sin() | cos() | tan() | asin() | acos() | atan() | atan2()

Description

abs(num) - absolute value (converts a number to its positive equivalent). Example: abs(-256) returns 256

ceil(num) - rounds a number up to the nearest integer. Example: ceil(25.66) returns 26

customizable_round_division(a,b,count) - divides two numbers and rounds the result to a specified number of decimal places (count), where a is the dividend and b is the divisor.

customizable_round_multiply(a,b,count) - multiplies two numbers and rounds the result to a specified number of decimal places (count), where a and b are the factors.

exp(num) - raising Euler’s number e to the power of the parameter. Example: exp(2) returns approximately 7.38905609893065

fac(num) - factorial of a number (takes one parameter). Example: fac(5) returns 120

floor(num) - returns the integer part of a number (rounds down). Example: floor(25.66) returns 25

int(num) - converts a floating-point number to an integer by truncating the decimal part. Example: int(1.8) returns 1

int_to_string(number, delimiter) - converts a number to a string with the specified delimiter.

is_float(txt) - checks whether a string is a number (including decimals).

is_int(txt) - checks whether a string is a number. Example: is_int("5") returns True, while is_int("text") returns False

log(num, base) - calculates the logarithm of a number taking two parameters: the number and the base (default is e). Example: log(E) returns 1 (where E is Euler’s number), log(100, 10) returns 2

max(a, b, c) - finds the maximum number among the listed values accepting an unlimited number of parameters (each must be a number). Example: max(4, 2, 9, 6) returns 9

md5(text) - generates an MD5 hash from a string. Example: hash = md5("Hello world") returns 3e25960a79dbc69b674cd4ec67a72c62

min(a, b, c) - finds the minimum number among the listed values accepting an unlimited number of parameters (each must be a number). Example: min(4, 2, 9, 6) returns 2

pow(num, st) - raises a number to a power taking two parameters: the base number and the exponent. Example: pow(5, 2) returns 25

pyt(a, b) - Calculates the square root of the sum of the squares of two values accepting two parameters: a and b. Example: pyt(5, 2) returns 5.385164807134504

random(low, high) - generates a random number. The function takes two parameters: the lower bound and the upper bound. Example: random(-10, 10)

round(num) - performs mathematical rounding of a number. Example: round(1.8).

You can also round to a specific number of decimal places. Example: round(1.8888888, 2) returns 1.89.

sha1(text) - generates a SHA-1 hash from a string. Example: hash = sha1("Hello world") returns 7b502c3a1f48c8609ae212cdfb639dee39673f5e

sha256(text) - generates a SHA-256 hash from a string. Example: hash = sha256("Hello world") returns 64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c

sqrt(num) - calculates the square root of a number taking one parameter: the number. Example: sqrt(25) returns 5

sin() cos() tan() asin() acos() atan() atan2() - trigonometric functions (remember to consider their domains).

Example

Let’s try this function! It’s really simple: just enter it, specify the parameters, and get the result — just like in math!

Here is the result:

Example of using int_to_string():

Code example for copying

Code for the "Message" field:

abs(#{A}) = #{a1} 
ceil(#{X}) = #{b1} 
customizable_round_multiply(#{X}, #{Y}, 2) = #{c1}
customizable_round_division(#{X}, #{Y}, 3) = #{d1} 
exp(4) = #{e1}
fac(#{C}) = #{f1}
floor(#{X}) = #{g1}        
floor(#{Y}) = #{floor(#{Y})}
int(#{X}) = #{h1}            
int(#{Y}) = #{int(#{Y})}
is_float("#{text}") = #{i1}      
is_float("#{X}") = #{is_float("#{X}")}    
is_int("#{text}") = #{j1}         
is_int("#{C}") = #{is_int("#{C}")}
is_int("#{X}") = #{is_int("#{X}")}
log(#{C}) = #{k1}
max(#{X}, #{Y}, #{C}) = #{l1} 
md5("#{text}") = #{m1} 
min(#{X}, #{Y}, #{C}) = #{n1}
pow(#{C},#{C}) = #{o1} 
pyt(5,2) = #{o2}
random(0, #{C}) = #{p1} 
round(#{Y}) = #{r1}
sha1("#{text}") = #{s1}
sha256("#{text}") = #{t1}
sqrt(#{C}) = #{u1} 
sin(#{X}) = #{v1}
cos(#{X}) = #{w1}
tan(#{X}) = #{x1} 
asin(#{L}) = #{y1} 
acos(#{L}) = #{a2} 
atan(#{X}) = #{b2} 
atan2(#{X},#{Y}) = #{c2}

Code for the "Calculator" field:

/*setting universal numbers for calculations*/
X=1.275
Y=5.822
A=-2.352
C=5
L=0.5
text="Hello, World!"
/*calculation*/
a1=abs(A) 
b1=ceil(X) 
c1=customizable_round_multiply(X,Y,2) 
d1=customizable_round_division(X,Y,3) 
e1=exp(4) 
f1=fac(C) 
g1=floor(X) 
h1=int(X) 
i1=is_float(text) 
j1=is_int(text) 
k1=log(C) 
l1=max(X,Y,C) 
m1=md5(text) 
n1=min(X,Y,C) 
o1=pow(C,C) 
o2=pyt(5,2)
p1=random(0,C) 
r1=round(Y) 
s1=sha1(text) 
t1=sha256(text) 
u1=sqrt(C) 
v1=sin(X) 
w1=cos(X) 
x1=tan(X) 
y1=asin(L) 
a2=acos(L) 
b2=atan(X) 
c2=atan2(X,Y)

Working with coordinates

distance()

Description

distance(lat1, lon1, lat2, lon2)- calculates the distance between two coordinates in kilometers

lat1, lat2 - latitude of the starting and ending points

lon1, lon2 - longitude of the starting and ending points

Examples

Example: distance(52.2296756, 21.0122287, 52.406374, 16.9251681)

Result: 278.5459739738798

Last updated