Share this page

# 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

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: