Re:We need to talk about parentheses
by dheera on Monday February 12, 2024 @12:44PM
(#39347863)
The REAL problem comes from math and physics teachers (even at the university level) writing things like:
(a + b) / 2π
instead of
(a + b) / (2π)
It seems that math teachers put division above multiplication in order of operations but programming languages almost universally treat division and multiplication as equal and read them left-to-right. I've fixed multiple bugs before that were due to this.
(a + b) / 2π
instead of
(a + b) / (2π)
It seems that math teachers put division above multiplication in order of operations but programming languages almost universally treat division and multiplication as equal and read them left-to-right. I've fixed multiple bugs before that were due to this.