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"

Operation Precedence of math operation in editor is wrong

When typing math operation in editor, the precedence of operations is wrong. Either it's from right to left, or the multiplication have bigger priority than division.

If I type 10 / 2 * 2 It should be: 10 / 2 * 2 5 * 2 = 10, but editor says it;s 2.5

alt text

alt text

Product Version: UE 4.18
Tags:
more ▼

asked Dec 10 '17 at 12:15 PM in Bug Reports

avatar image

dzarafata
132 6 15 20

avatar image cm17 Mar 12 '18 at 06:58 PM

It's still an issue.

Subtraction and divisions are left-associative. This is a fact, it's not negotiable and the calculations done by the UE are just wrong.

=== === === === ===

UE - right-associative -> WRONG

5-5-5=5 -> (5)-(5-5)

10/10/10=10 -> (10)/(10/10)

=== === === === ===

conventional math - left-associative -> CORRECT

5-5-5=-5 -> (5-5)-(5)

10/10/10=0.1 -> (10/10)/(10)

=== === === === ===

Please fix it

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

1 answer: sort voted first

Looks correct. The order is Left to Right a*b a/b a%b ....

http://en.cppreference.com/w/cpp/language/operator_precedence

So it would equate to 2*2 = 4 then 10 / 4 = 2.5

I guess you could always type it like this (10/2)*2

more ▼

answered Dec 10 '17 at 12:43 PM

avatar image

SouthBot
46 1 5

avatar image dzarafata Dec 10 '17 at 12:51 PM

alt text The order being from left to right means that the first operation form left, which is / should be computed first. I attach C++ code from Visual Studio 201.

(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