Skip to main content
4 of 5
added 4 characters in body; edited body
Kevin Brown-Silva
  • 6.5k
  • 5
  • 42
  • 59

PHP, 51 45 43 37 characters

function f($n){return~~$n-(~~$n>$n);} This should be able to be applied to most languages that do not support the n%1 trick.
Kevin Brown-Silva
  • 6.5k
  • 5
  • 42
  • 59