llroundf


Description:

public int64 llroundf (float x)

Rounds it's argument to the nearest integer value, rounding away from zero, regardless of the current rounding direction.

Note:

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

If x is infinite or float.NAN, or if the rounded value is outside the range of the return type, the numeric result is unspecified.

A domain error may occur if the magnitude of x is too large.

Example: Round float to int64:

public static int main (string[] args) {
// Output:
// ``llroundf (0.3f) = 0``
// ``llroundf (0.4f) = 0``
// ``llroundf (0.5f) = 1``
// ``llroundf (0.6f) = 1``

print ("llroundf (%.1lff) = %" + int64.FORMAT + "\n", 0.3f, Math.llroundf (0.3f));
print ("llroundf (%.1lff) = %" + int64.FORMAT + "\n", 0.4f, Math.llroundf (0.4f));
print ("llroundf (%.1lff) = %" + int64.FORMAT + "\n", 0.5f, Math.llroundf (0.5f));
print ("llroundf (%.1lff) = %" + int64.FORMAT + "\n", 0.6f, Math.llroundf (0.6f));

return 0;
}

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

Parameters:

x

A numeric value.


Namespace: GLib.Math
Package: glib-2.0