sqrt


Description:

public double sqrt (double x)

Returns the non-negative square root of x.

Note:

Remember to link the math library: valac -X -lm ...

It fails and sets GLib.errno to EDOM , if x is negative.

Example: Square root (double):

public static int main (string[] args) {
// /----
// sqrt (4) = \/ 4 = 2
//

// Output: ``sqrt (4.0) = 2.000000``
double res = Math.sqrt (4.0);
print ("sqrt (4.0) = %lf\n", res);
return 0;
}

valac --pkg glib-2.0 -X -lm GLib.Math.sqrt.vala

Parameters:

x

A numeric value.


Namespace: GLib.Math
Package: glib-2.0