math.sqrt

Supported in:
math.sqrt(number)

Description

Returns the square root of the given number. Returns 0 in case of negative numbers.

Param data types

INT|FLOAT

Return type

FLOAT

Code samples

Example 1

This example returns the square root of an int argument.

math.sqrt(3) = 1.732051
Example 2

This example returns the square root of a negative int argument.

math.sqrt(-3) = 0.000000
Example 3

This example returns the square root of zero argument.

math.sqrt(0) = 0.000000
Example 4

This example returns the square root of a float argument.

math.sqrt(9.223372) = 3.037000
Example 5

This example returns the square root of a negative float argument.

math.sqrt(0-1.200000) = 0.000000