Pretty much every commonly used programing language gives the same level of precedence to multiplication/division and addition/subtraction, so they should always return 1 when it comes to that final step (provided you did that division by a fraction part correctly).
However, youâre absolutely correct that the middle section could cause you some serious headaches when it comes to programming the calculation.
Personally, Iâd always recommend using more sets of parentheses than you think you need, to make sure that everything gets executed in the correct order.
Without them, that central part would be calculated as (3 / 1) / 3
when you actually want 3 / (1 / 3)
.
Personally Iâd write the full equation as 9 - ( 3 / (1/3) ) + 1
to make things as obvious as necessary.
However, you good go full overkill and write ( 9 - ( 3 / ( 1 / 3 ) ) ) + 1
to make things painfully clear.
Math is definitely a funny thing and something that our brains are not really wired to do naturally.
It always reminds me of a quote, which (I think) was from Cedric Villani (Iâm also paraphrasing):
âEverybody finds math difficult, the difference with mathematicians is that we enjoy the challengeâ.