Logo Search packages:      
Sourcecode: gcc-2.95 version File versions

bug-40189-2.c

#include <stdio.h>
#include <math.h>


int
main() {

  double a[4] = { 0.006776, 2.5, 3.0, 0.006776 },
       w[4] = { 0.000030, 3.7, 3.0, 0.000030 },
       t, amin;
  int ir, i, nr = 4;
  double tol = 9.31322574615479e-10*3.0;

  for (i=0, ir=-1, amin=DBL_MAX; i < nr; i++) {
    printf("amin=%17g; ir=%d; w=%17g, a=%17g; t=%17g\n",
           amin, ir, w[i], a[i], w[i] / a[i]);
    if (a[i] > tol) {
      t = w[i] / a[i];
      if (t < amin || ir == -1) {
        amin = t;
        ir = i;
      }
    }
  }
  
  printf("amin=%g; ir=%d\n", amin, ir);

  for (i=0, ir=-1, amin=DBL_MAX; i < nr; i++) {
    printf("amin=%17g; ir=%d; w=%17g, a=%17g; t=%17g\n",
           amin, ir, w[i], a[i], w[i] / a[i]);
    if (a[i] > tol && ((t=w[i]/a[i]) < amin || ir == -1)) {
      amin = t;
      ir = i;
    }
  }
  
  printf("amin=%g; ir=%d\n", amin, ir);

  exit(0);
}

Generated by  Doxygen 1.6.0   Back to index