previous | start | next

Associativity - multiplication

int main()
{
  float x = 10.0F;
  float y = 1e38;
  float z = 1e-38;
  float w;

  w = (x * y);
  w = w * z;

  printf("(%g * %g) * %g = %g\n", x, y, z, w);


  w = (y  * z);
  w = x * w;
  printf("%g * (%g * %g) = %g\n", x, y, z, w);

  return 0;

}
Output:
(10 * 1e+38) * 1e-38 = inf
10 * (1e+38 * 1e-38) = 10



previous | start | next