Backend workflow number calculation different than frontend

Hello,

I have a calculation on the frontend page of our app which calculates this equation correctly:

2.0-1.5* 0.8 * 10000-150 * 0.85

(ignore spaces as it’s saving to this post funny, there’s no spaces in our equation).

However when I try to do the same in a backend workflow I’m getting a different number.

I’ve tried about 7 different plugin which can do calculations in the backend however the value is always different than if ran on the frontend.

I am hoping someone can provide some insight here as I’m quite confused.

Thank you!

What numbers are you getting?

2 separate numbers.

The frontend is correct, the backend workflow is not.

Yeah you said that already…

I asked what numbers you were getting.

And also, what are you using to do the calculations?

On the frontend it’s an input.

On the backend workflow it’s making a change to a thing.

Usually the numbers are off by a couple hundred. To protect the client I cannot give the exact equation. Nonetheless, if the backend calculates differently than the frontend I’d imagine others have experienced this also.

Are you using the parenthetical for your expression calculation? That may give you more control in case it’s a PEMDAS math order issue…

There could be several logical reasons why you might be getting different results here, or it could be some kind of bug… but without knowing the specific numbers, or what methods you’re using to calculate them it’s anyone’s guess. But I’d say the most likely is order of operations, so investigate that first.

I’m not.

Could you give me an example of how that would look?

Thank you!

1 Like

Enable parentheses in versions. Then it’s just a case of using the expression builder to create your expression with brackets in the correct place… from the little information you’ve provided we couldn’t possibly tell you exactly where to put the brackets

1 Like

Update: I enabled the parentheses version and unfortunately this still didn’t do it for me. Again frontend works as expected.

For the backend workflow I have to chop up my equation like:

make changes to a thing: 1-2

Then, make changes to a thing: Total *8 ect ect.

Seems to work now.

This topic was automatically closed after 70 days. New replies are no longer allowed.