is_infinity


Description:

[ CCode ( cname = "isinf" ) ]
public int is_infinity ()

Determines if the given floating point number is a negative or positive infinity

Example: Check whether a float is infinite:

public static int main (string[] args) {
// Output: ``inf -- 1 -- false``
float val = float.INFINITY;
print ("%f -- %s -- %s\n", val, val.is_infinity ().to_string (), val.is_finite ().to_string ());

// Output: ``nan -- 0 -- false``
val = float.NAN;
print ("%f -- %s -- %s\n", val, val.is_infinity ().to_string (), val.is_finite ().to_string ());

// Output: ``0.300000 -- 0 -- true``
val = 0.3f;
print ("%f -- %s -- %s\n", val, val.is_infinity ().to_string (), val.is_finite ().to_string ());

return 0;
}

valac --pkg glib-2.0 float.is_infinity.vala