acos


Description:

public double acos (double x)

Calculates the arc cosine of x.

Note:

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

That is the value whose cosine is x. If x falls outside the range -1 to 1, GLib.Math.acos fails and GLib.errno is set to EDOM .

Example: Arc cosine (double):

public static int main (string[] args) {
// Output: ``acos (0.500000) = 1.047198``
double x = 0.5;
double res = Math.acos (x);
print("acos (%lf) = %lf\n", x, res);


// Output: ``acos (1.000000) = 0.000000``
x = 1;
res = Math.acos (x);
print("acos (%lf) = %lf\n", x, res);


// Output: ``acos (2.000000) = nan``
x = 2;
res = Math.acos (x);
print("acos (%lf) = %lf\n", x, res);

return 0;
}

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


Namespace: GLib.Math
Package: glib-2.0