is_finite
Description:
Determines if the given floating point number has finite value i.e. it is normal, subnormal or zero, but not infinite or NAN.
Example: Check whether a float is finite:
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_finite.vala