Less math functions are the methods which are used to perform numeric operations such as round, square root, power value, modulus, percentage etc.
A list of math functions used in Less:
Index |
Function |
Description |
Example |
1) |
It is used to round up the number to next highest integer. |
ceil(0.7) it round the number to:1 |
|
2) |
It is used to round down the number to next lowest integer. |
floor(5.3) it round the number to:5 |
|
3) |
It is used to transform the floating point number to
percentage string. |
percentage(0.5): it is equivalent to 50%. |
|
4) |
It is used to round a floating point number. |
round(4.77): it converts the number to the rounding value as:5 |
|
5) |
It is used to get the square root of a number. |
sqrt(36): it defines the square root of the number as: 6 |
|
6) |
It is used to get the absolute value of a number. |
abs(30ft): it displays the absolute value as: 30ft |
|
7) |
It is used to get radian on numbers. |
sin(2): it calculates the sine value as: 0.90929742682 |
|
8) |
it is used to return arcsine (inverse of sine) of a number
which returns value between -pi/2 and pi/2. |
asin(1):it calculates the asin value as: 1.5707963267948966 |
|
9) |
It is used to get cosine of the specified value and determines
radians on numbers without units. |
cos(2): it calculates the cos value as: -0.4161468365471424 |
|
10) |
It is used to return arccosine (inverse of cosine) of a number
which returns value between 0 and pi. |
acos(1):it calculates the acos value as: 0 |
|
11) |
It is used to get tangent of the number. |
tan(60): it calculates the tan value as: 0.320040389379563 |
|
12) |
It is used to get arctangent (inverse of tangent) of a
specified number. |
atan(1): it displays atan value as: 0.7853981633974483 |
|
13) |
It is used to get the pi value. |
pi(): it determines the pi value as: 3.141592653589793 |
|
14) |
It is used to get the value of first argument raised to the
power of second argument. |
pow(3,3): it specifies the power value as: 27 |
|
15) |
It is used to get modulus of first argument with respect to
the second argument. it also handles negative and floating point numbers. |
mod(7,3): it returns the modulus value as: 1 |
|
16) |
It is used to get the smallest value of one or more arguments. |
min(70,40,55,10): it returns the minimum value as: 10 |
|
17) |
It is used to get the highest value of one or more arguments. |
max(70,40,55,10): it returns the maximum value as: 70 |
0 Comments