2.1.16.1.18 sqrt


Description

Calculates the square root of a complex value.


Calculates the square root of a double value.

Syntax

complex sqrt( complex z )


double sqrt( double x )

Parameters

z
[input] the complex value whose square root is sought.


x
[input] independent variable

Return

The square root of z.


The square root of x.

Examples

EX1

void    run_complex_sqrt()
{
    complex        cc(0., 8.);
    
    out_complex("sqrt = ", sqrt(cc)); // Result is "sqrt = 2.000000+2.000000i"
}


EX2

void    run_sqrt()
{
    double        rr = 625;
    double        val = sqrt(rr);
    
    printf("sqrt(%f) = %f\n", rr, val);
}

Remark

See Also

Header to Include

origin.h

Reference