MEGA_20250224 Has Broken Math Parsing

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
ThomasB
Normal user
Posts: 1361
Joined: 17 Jun 2018, 20:41
Location: USA

MEGA_20250224 Has Broken Math Parsing

#1 Post by ThomasB » 07 Mar 2025, 19:40

I perform a lot of math on system/dummy variables. Some complex statements use several levels of parenthesis to direct math order. The latest test build has broken the parsing.

I've been able to reduce the problem to demonstrate that math statements that use more than one level of parenthesis will result in a zero.

This works:

Code: Select all

Let,19,(1)*(0.5) 
But this fails:

Code: Select all

Let,19,((1)*(0.5))
The Dec-21-2024 release is working. The problem is with the latest test build (mega_20250224_climate_ESP32_4M316k).

- Thomas

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: MEGA_20250224 Has Broken Math Parsing

#2 Post by Ath » 07 Mar 2025, 22:28

Well, we did fix an issue in that area, but AFAIR/see, the side-effect is that it doesn't 'tolerate' an excess amount of braces. Though it should work as intended when just the right number of braces are used... :?
/Ton (PayPal.me)

User avatar
ThomasB
Normal user
Posts: 1361
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MEGA_20250224 Has Broken Math Parsing

#3 Post by ThomasB » 07 Mar 2025, 23:18

Thanks for jumping in. My previous examples show that the recent change needs some attention. The math breaks if more than one level of parentheses is used. Which is going to adversely affect some existing projects.

- Thomas

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MEGA_20250224 Has Broken Math Parsing

#4 Post by TD-er » 07 Mar 2025, 23:19

Yep, so it should for sure be fixed...
Anyway thanks for making it a very small and easy to reproduce test.

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MEGA_20250224 Has Broken Math Parsing

#5 Post by TD-er » 10 Mar 2025, 21:48

Can you test the proposed fix here: https://github.com/letscontrolit/ESPEasy/pull/5280

If you need a test build, please let me know what build I should make for you.

User avatar
ThomasB
Normal user
Posts: 1361
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MEGA_20250224 Has Broken Math Parsing

#6 Post by ThomasB » 10 Mar 2025, 22:58

It would be fantastic if you could build climate_ESP32_4M316k for me.

- Thomas

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MEGA_20250224 Has Broken Math Parsing

#7 Post by TD-er » 10 Mar 2025, 23:10

ThomasB wrote: 10 Mar 2025, 22:58 It would be fantastic if you could build climate_ESP32_4M316k for me.

- Thomas
You may have to scroll down to the end :)

https://github.com/letscontrolit/ESPEas ... 3774469697

User avatar
ThomasB
Normal user
Posts: 1361
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MEGA_20250224 Has Broken Math Parsing

#8 Post by ThomasB » 10 Mar 2025, 23:30

It's working! Thanks.

- Thomas

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MEGA_20250224 Has Broken Math Parsing

#9 Post by TD-er » 10 Mar 2025, 23:32

Can you also test some other calculation related code to see if I may have broken other stuff?
The entire fix was to remove the "//" in front of an "else".

User avatar
ThomasB
Normal user
Posts: 1361
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MEGA_20250224 Has Broken Math Parsing

#10 Post by ThomasB » 11 Mar 2025, 00:45

No other math issues have been observed.

I saw that your fix was to uncomment the "else" statement. Surprised to see that the conditional had been disabled.

- Thomas

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MEGA_20250224 Has Broken Math Parsing

#11 Post by TD-er » 11 Mar 2025, 00:52

Yep, I was also surprised when looking through the diffs.
Also I could not understand _why_ it was disabled.

That piece of rules parsing code already isn't that easy to read and understand, so it did take a while to come to the conclusion I had no clue to why that would have been disabled and thus enabled it again and it was working :)

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests