Skip to main content
added 169 characters in body
Source Link
Tanj
  • 269
  • 1
  • 3

Julia 1.0, 2317 bytes

Save 6 bytes thanks to the awesome comments of MarcMush!

x->x-x%1+sign(rem>x+sign(x,1)x%=1)-x

Try it online!Try it online!

An alternative with the same number of22 bytes

  
x->sign(x)*ceilceil(abs(x))

Try it online!Try it online!

Julia 1.0, 23 bytes

x->x-x%1+sign(rem(x,1))

Try it online!

An alternative with the same number of bytes

 
x->sign(x)*ceil(abs(x))

Try it online!

Julia 1.0, 17 bytes

Save 6 bytes thanks to the awesome comments of MarcMush!

x->x+sign(x%=1)-x

Try it online!

An alternative with 22 bytes

 
x->sign(x)ceil(abs(x))

Try it online!

Source Link
Tanj
  • 269
  • 1
  • 3

Julia 1.0, 23 bytes

x->x-x%1+sign(rem(x,1))

Try it online!

An alternative with the same number of bytes

x->sign(x)*ceil(abs(x))

Try it online!