#include<stdio.h>

int main()
  {
  double summands[6];
  double sum = 0.75, sum_bottom_up, sum_top_down;
  int i;

  summands[0] = 5.0 * 64.0 * 33554432.0 * 33554432.0 * 33554432.0 * 33554432.0; /*pow(2,108) + pow(2,106) = (2^2+1) * * 2^6 * 2^25 * 2^25 * 2^25 * 2^25; */
  summands[1] = 2.0 * 67108864.0 * 67108864.0; /* pow(2,52) = 2^26 squared; */
  summands[2] = -summands[0];
  summands[3] = summands[1];
  summands[4] = 0.75;
  summands[5] = -2.0 * summands[1];

for(i=0; i<6; i++)
  printf("summands[%d] = %15.2e\n", i, summands[i]);

  printf("exact sum = %15.2f\n", sum);

  sum_bottom_up = 0.0;
  for(i=5; i>=0; i--)
    sum_bottom_up += summands[i];
  printf("sum bottom up   = %15.2e\n", sum_bottom_up);

  sum_top_down = 0.0;
  for(i=0; i<6; i++)
    sum_top_down += summands[i];
  printf("sum top down    = %15.2e\n", sum_top_down);

  return 0;
  }
