(PTEIMSC)
![]()
No, the title is not a clever euphemism. It’s as literal as you can get.
At work the other day there was a defect filed in which an extremely long (but simple) equation was causing an expression evaluator to crash. The equation was just a really long string like “6+5+1-3-7+3+6...“. The end result of that equation wasn’t really important, but I was curious.
My normal train of thought is to first decide that I’d have to type each number, one by one, into Microsoft’s Calculator. Next I’ll think “I should just write a quick script to add those up”. But that day, something else occurred to me: “I wonder if I can just paste it right in”?
And you know what? You can!
Try it out:
4 + 2 / 3 = 4.6666666666666666666666666666667
Oops. Can I adjust the order of operation?
(4 + 2) / 3 = 2
Yep!
Kind of ridiculous, I know. But sooner or later you’ll come across some scenario where you’ve got a string full of pluses and minuses and really, all you need is the result. And when that day arrives, you’ll thank me for this nugget.
Comments are Okay