Both are poorly written formulas, lacking specificity and proper “punctuation”. Your calculator is doing it’s best with a set of rules coded into it, which you can usually find with its operating manual (for scientific ones, at least).
School tests are intentionally designed to be ambiguous, and make it more difficult than it needs to be. This also is a disservice to educators and the students forced to dance to this nonsense. No self-respecting mathemetician would write these. There is no amount of PEMDAS that will fix these meaningless formulas.
Latest Answers