sqrtf


Description:

public float sqrtf (float 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 (float):

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

// Output: ``sqrtf (4.0f) = 2.000000f``
float res = Math.sqrtf (4.0f);
print ("sqrtf (4.0f) = %lff\n", res);
return 0;
}

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

Parameters:

x

A numeric value.


Namespace: GLib.Math
Package: glib-2.0