Float to string conversion issue

Hi, When I try to convert float “11” i get string “11.0000001”

Same problem when I use SpinBox. When I set SpinBox delta to 0.001 I get 0; 0.001; 0.002 etc but sometimes 0.0030001 what looks terrible

Hi ,

What you’re seeing is a floating point error. You can read more about it here:

For an example of how to work around it in UE4, there are a couple of good posts on AnswerHub, such as this one:

Hope that helps!

Yeah but if I use UMG would be nice if at least I be able to set precision (decimal numbers).

22223-precision_issue.png

In component editor is same. Starting from value 0 and moving something left then right using arrow gives values 8.9999999 or 0.0000013

I don’t worry about myselft but I worry about all people playing game and seeing 8,99999999 instead. Many times number is drawing out of graphics.

It’s not a problem to write function with floor, integer and string parse to get precision I want but UMG lets me only to set float. I think SpinBox → Content → Delta should be more like string precion not only step for float.

Thank You for Your answer.