Skip to content

Mathematical order of opperations in script is wrong #1029

@TomNysWF

Description

@TomNysWF

Describe the bug
As seen in the screenshot below, the math is wrong when doing A - B + C. It seems to interpret it as A - ( B +C ) instead of the normal order of opperations. As a bonus issue (altough not really a problem) there seems to be a weird floating point issue

Image

How to Reproduce*

As seen in the above screenshot, a simple script is enough to reproduce this error.

<?xml version="1.0" encoding="UTF-8"?>
<root BTCPP_format="4"
      main_tree_to_execute="test">

  <BehaviorTree ID="test">
      <Script code="value_1  := 0.0932;&#10;value_2:= 0.026;&#10;incorrect_result:=  value_1  - value_2 + 0.0035;&#10;correct_result:=  (value_1  - value_2) + 0.0035"/>
  </BehaviorTree>`
<?xml version="1.0" encoding="UTF-8"?>
<root BTCPP_format="4"
      main_tree_to_execute="test">

  <BehaviorTree ID="test">
      <Script code="value_1  := 0.0932;&#10;value_2:= 0.026;&#10;incorrect_result:=  value_1  - value_2 + 0.0035;&#10;correct_result:=  (value_1  - value_2) + 0.0035"/>
  </BehaviorTree>
</root>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions