Example: Rounds x downward (double)

public static int main (string[] args) {
// Output:
// ``floor (3.1) = 3.0``
// ``floor (3.9) = 3.0``
print ("floor (%.1lf) = %.1lf\n", 3.1, Math.floor (3.1));
print ("floor (%.1lf) = %.1lf\n", 3.9, Math.floor (3.9));
return 0;
}

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

See:




2022 vala-language.org