previous | start | next

Associativity - addition

For IEEE floating point values, it is not always the case that the order of addition is associative. That is, it can happen that

      (a + b) + c is not equal to a + (b + c)
   

Example:

      float a = 2.718
      float b = 1e35
      float c = -1e35

      (a + b) + c is 0
      a + (b + c) is 2.718
   


previous | start | next