Description

This is not a regression. Tested in //UE5/Release-5.0 CL20979098

FMath::Eval ignores groupings while solving problems. This has caused some confusion with users who are expecting the groupings to be solved first before the rest of the problem following the order of operations.

Steps to Reproduce
  1. Create or open a C++ project
  2. Create a new C++ Actor
  3. Close the Editor once Visual Studio is open
  4. In the .cpp file:
    1. On line 5 after first include add: #include "Math/UnrealMathUtility.h"
    2. On line 18 after Super::BeginPlay() add:
      float OutValue;
      FMath::Eval("((1.0 - 0.2) * 10.0)", OutValue);
      UE_LOG(LogTemp, Warning, TEXT("%f"), OutValue);
  5. Press Ctrl+f5 in Visual Studio
  6. Once the Editor launches place the C++ Actor in the level
  7. Press play
  8. Observe the Output log

Expected Results:
In the output log there is a warning stating: LogTemp: Warning: 8.000000

Actual Results:
In the output log there is a warning stating: LogTemp: Warning: 0.800000

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-169592 in the post.

0
Login to Vote

Unresolved
ComponentUE - Foundation
Affects Versions5.1
Target Fix5.2
CreatedNov 8, 2022
UpdatedJan 20, 2023