Example: sqrt

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