sqrt

Mathematics Functions

Computes the square root of x.

double sqrt( double x);

x A number.

Return Values

The square root of the specified number.

Example

The following example calculates the square root of various numbers using sqrt. Note that if x is negative, an indefinite result is returned.

// Explicit forward declaration
    double sqrt(double x); 
    lr_output_message ("Square root of 9 = %f\n", sqrt(9));
    lr_output_message ("Square root of 8 = %f\n", sqrt(8));
    lr_output_message ("Square root of -8 = %f\n", sqrt(-8));
Example: Output:
Action.c(5): Square root of 9 = 3.000000
Action.c(6): Square root of 8 = 2.828427
Action.c(7): Square root of -8 = -1.#IND00