x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: Not Selected
Tags:
more ▼

asked Nov 24 '14 at 04:05 PM in Bug Reports

avatar image

Tefel
24 3 8 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Tefel,

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

http://floating-point-gui.de/

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

https://answers.unrealengine.com/questions/76911/are-floats-broken-or-is-this-some-precision-issue.html

Hope that helps!

more ▼

answered Nov 24 '14 at 06:30 PM

avatar image Tefel Nov 26 '14 at 09:38 AM

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

In component editor is the 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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question