g.js — graphical objects for JavaScript

roundround

Round off a number to the nearest integer.

Rounding up when integer is closer upwards:

g.round(17.6);

Rounding down when integer is closer downwards:

g.round(17.4);

See Also

  • ceil: Round up a number to the nearest bigger integer.
  • floor: Round down a number to the nearest smaller integer.