3 ms·
I understand your confusion, but in math the + operator does not have to be commutative either. It often is, but just like in programming, you can define in it
by enaaem 7y ago
I understand your confusion, but in math the + operator does not have to be commutative either. It often is, but just like in programming, you can define in it anyway you want.
- contravariant 7y agoBy convention the + operator is usually reserved for commutative operations though.
- joppy 7y agoI have never seen + be used for a non-commutative operation in mathematics. I have seen it used for something which is to-be-proven-to-be-commutative in the next page or so. Similarly, I have only ever seen juxtaposition (like “ab”) used for associative operations, I.e satisfying a(bc) = (ab)c.
- yiyus 7y agoMultiplication of octonions is non-associative and usually expressed by simple juxtaposition.
- deleted 7y ago[deleted]
- Silhouette 7y agoThis is a recurring problem when working with floating point values. Intuitions about concepts like associativity or even equality don't necessarily hold, but in many cases you will still get away with it, so it can feel like there's inconsistent or unpredictable behaviour. That can be a big stumbling block for inexperienced programmers working with this type of data at first, and it surely leads to many bugs. With experience, programmers adjust their intuitive expectations and guarding against these kinds of bugs becomes second nature, and to some extent that is probably the best we can do because of the nature of the beast. However, it does illustrate the cost of violating intuitive expectations about how familiar operators and functions will behave.