When dealing with float values, we’re often less interested in the exact value and can make do with a more human readable one. Unreal Engine has a couple of rounding functions we can use to make this happen: Ceil to Integer and Floor to Integer.
Ceil rounds up, so 1.6 becomes 2 and -1.6 becomes -1.
Likewise floor rounds down, so 1.6 becomes 1 and -1.6 becomes -2.
There are two related functions called Ceil to Integer64 and Floor to Integer 64, both of which use a 64bit integer rather than a 32bit integer value. The difference is the size of the number these can hold and convert:
- 16bit integers: -32,768 to +32,767
- 32bit integers: -2,147,483,648 to +2,147,483,647
- 64bit integers: -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
Yeah so we’re probably OK with the 32bit variants most of the time.