# Rounding floats

**URL:** https://forum.highend3d.com/t/rounding-floats/4992
**Category:** Maya
**Tags:** mel
**Created:** [August 26, 2003, 3:25pm UTC](https://forum.highend3d.com/t/rounding-floats/4992 "2003-08-26T15:25:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![satchmo](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/s/53a042/32.png) [@satchmo](https://forum.highend3d.com/u/satchmo)
#### Post date: [August 26, 2003, 3:25pm UTC](https://forum.highend3d.com/t/rounding-floats/4992/1 "2003-08-26T15:25:58Z")

</div>

Either I'm retarded for not being able to find this, Maya is retarded for not having it built in:

Is there a command for rounding floats to integers? Straight declaration only truncates it (ie. int $blah = 45.6 returns 45, not 46). It's easy to put this in an "if" statement, but I shouldn't have to.

---

<div class="post-metadata">

### Author: ![gdc](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gdc](https://forum.highend3d.com/u/gdc)
#### Post date: [August 26, 2003, 6:50pm UTC](https://forum.highend3d.com/t/rounding-floats/4992/2 "2003-08-26T18:50:41Z")

</div>

how about ceil and floor?

floor 45.6;  
// Result: 45 //

ceil 45.6;  
// Result: 46 //

--g

---

<div class="post-metadata">

### Author: ![dbiggs](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@dbiggs](https://forum.highend3d.com/u/dbiggs)
#### Post date: [August 26, 2003, 11:03pm UTC](https://forum.highend3d.com/t/rounding-floats/4992/3 "2003-08-26T23:03:03Z")

</div>

or there's

[http://www.ewertb.com/maya/mel/mel\_a39.html](http://www.ewertb.com/maya/mel/mel%5C_a39.html)
