floor.js 505 B

12345678910111213141516171819202122232425
  1. var createRound = require('../internal/createRound');
  2. /**
  3. * Calculates `n` rounded down to `precision`.
  4. *
  5. * @static
  6. * @memberOf _
  7. * @category Math
  8. * @param {number} n The number to round down.
  9. * @param {number} [precision=0] The precision to round down to.
  10. * @returns {number} Returns the rounded down number.
  11. * @example
  12. *
  13. * _.floor(4.006);
  14. * // => 4
  15. *
  16. * _.floor(0.046, 2);
  17. * // => 0.04
  18. *
  19. * _.floor(4060, -2);
  20. * // => 4000
  21. */
  22. var floor = createRound('floor');
  23. module.exports = floor;