Math functions

These functions helps you to perform complex math operations like square root, cube root, logarithm, etc. with great ease.

SRON provides 13 major math functions given below:

  • abs()

  • cbrt()

  • ceil()

  • cos()

  • floor()

  • log()

  • log2()

  • log10()

  • max()

  • min()

  • sin()

  • sqrt()

  • tan()


1. abs() :

Returns the absolute value of a number, disregarding its sign, making negative numbers positive.

OUTPUT:

153.2356 67


2. cbrt() :

Computes the cube root of a number, finding the value that, when multiplied by itself twice, equals the original number.

OUTPUT:

4


3. ceil() :

Rounds a number up to the nearest integer, returning the smallest integer greater than or equal to the input.

OUTPUT:

154 123


4. cos() :

Calculates the cosine of an angle given in radians, representing the ratio of the adjacent side to the hypotenuse in a right triangle.

OUTPUT:

-0.996088


5. floor() :

Rounds a number down to the nearest integer, returning the largest integer less than or equal to the input.

OUTPUT:

123 63


6. log() :

Computes the natural logarithm of a number, representing the power to which the base 'e' (approximately 2.718) must be raised to equal the input.

OUTPUT:

4.00733


7. log2() :

Calculates the base-2 logarithm of a number, determining the exponent to which the base 2 must be raised to produce the input.

OUTPUT:

5.78136


8. log10() :

Computes the base-10 logarithm of a number, indicating the exponent to which the base 10 must be raised to yield the input.

OUTPUT:

1.74036


9. max() :

Returns the maximum value from a sequence of numbers or values, identifying the largest element.

OUTPUT:

100


10. min() :

Retrieves the minimum value from a series of numbers or values, identifying the smallest element.

OUTPUT:

-145


11. sin() :

Computes the sine of an angle in radians, representing the ratio of the length of the side opposite the angle to the length of the hypotenuse in a right triangle.

OUTPUT:

0.850904


12. sqrt() :

Calculates the square root of a number, determining the value that, when multiplied by itself, equals the input.

OUTPUT:

16


13. tan() :

Computes the tangent of an angle given in radians, representing the ratio of the length of the side opposite the angle to the length of the adjacent side in a right triangle.

OUTPUT:

-0.420701


Last updated