description
math functions includes methods which are used for performing numeric operations such as round, square root, power value, modulus, percentage, etc.
following table shows math functions used in less −
| sr.no. | function & description | example |
|---|---|---|
| 1 |
ceil it rounds up the number to next highest integer. |
ceil(0.7) it round the number to − 1 |
| 2 |
floor it rounds down the number to next lowest integer. |
floor(3.3) it round the number to − 3 |
| 3 |
percentage it transforms the floating point number to percentage string. |
percentage(0.2) it converts the number to percentage string as − 20% |
| 4 |
round it rounds a floating point number. |
round(3.77) it converts the number to the rounding value as − 4 |
| 5 |
sqrt it returns the square root of a number. |
sqrt(25) it defines the square root of a number as − 5 |
| 6 |
abs it provides the absolute value of a number. |
abs(30ft) it displays the absolute value as − 30ft |
| 7 |
sin it returns radians on numbers. |
sin(2) it calculates the sine value as − 0.90929742682 |
| 8 |
asin it specifies 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 |
cos it returns cosine of the specified value and determines radians on numbers without units. |
cos(2) it calculates the cos value as − -0.4161468365471424 |
| 10 |
acos it specifies arccosine (inverse of cosine) of a number which returns value between 0 and pi. |
acos(1) it calculates the acos value as − 0 |
| 11 |
tan it specifies tangent of the number. |
tan(60) it calculates the tan value as − 0.320040389379563 |
| 12 |
atan it specifies arctangent (inverse of tangent) of a specified number. |
atan(1) it displays atan value as − 0.7853981633974483 |
| 13 |
pi it returns the pi value. |
pi() it determines the pi value as − 3.141592653589793 |
| 14 |
pow it specifies the value of first argument raised to the power of second argument. |
pow(3,3) it specifies the power value as − 27 |
| 15 |
mod it returns 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 |
min it specifies the smallest value of one or more arguments. |
min(70,30,45,20) it returns the minimum value as − 20 |
| 17 |
max it specifies the highest value of one or more arguments. |
max(70,30,45,20) it returns the maximum value as − 70 |