# How to round a float to two decimals?

**URL:** <https://forums.unrealengine.com/t/how-to-round-a-float-to-two-decimals/457739>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [October 29, 2019, 4:19pm UTC](https://forums.unrealengine.com/t/how-to-round-a-float-to-two-decimals/457739 "2019-10-29T16:19:55Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [April 7, 2023, 3:21am UTC](https://forums.unrealengine.com/t/how-to-round-a-float-to-two-decimals/457739/6 "2023-04-07T03:21:35Z")

</div>

This was just answered here, too:

> [@Need to round float to one decimal point. Why is it so difficult?](https://forums.unrealengine.com/t/need-to-round-float-to-one-decimal-point-why-is-it-so-difficult/866763/8):
>
> The reason is that floating point numbers aren’t decimal. It’s literally impossible to represent 0.1 exactly in a floating point number. Computer can’t do it. 0.5, 0.25, 0.125, 0.0625, and other numbers that are even fractions of 2 are exactly representable. The problem is that you’re doing this: Try to represent a value that’s exactly 0.1 Present the value that’s stored above exactly What you should be doing is: Represent whatever the number actually is Present the number with rounding …

Use `ToText (float)` to present a floating point number with a fixed number of decimal digits.

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-round-a-float-to-two-decimals/457739)._
