Is it possible to write (a * b) + (c * d) in such a way as not to use the order of operations?

Ok, so warsow has pretty good hud code, except that the math logic is a little to blame.

Input:

a*b + c*d

Interpreted as:

((d*c) + b) * a

As you can see, the game performs a number of operations in the reverse order without regard to the order of operations. Brackets do not work in hud code. It must be a linear series of operations in order to come up with the final result. Is it possible? I understand that it would be better to implement the correct math in the hud code, but this is much more interesting than imo.

+3
source share
1 answer
a*b + a/c*d -> ((d*c/a) + b) * a

normal algebra is provided.

+6
source

Source: https://habr.com/ru/post/1765912/


All Articles