Esempio n. 1
0
int main(){
  for (double v = -20; v < 0; v += 0.1){
    std::cerr << v << "\t" << exp(v) << "\t" << fasterexp(v) << std::endl;
  }

  for (double v = -20; v < 0; v += 0.1){
    double x = exp(v);
    std::cerr << v << "\t" << log(x) << "\t" << fasterlog(x) << std::endl;
  }
}
Esempio n. 2
0
int 
main (int   argc,
      char *argv[])
{
  char buf[4096];

  (void) argc;

  float x;
  for (x = -50; x > -1000; x -= 100)
    {
      assert (fastexp (x) >= 0);
      assert (fasterexp (x) >= 0);
#ifdef __SSE2__
      v4sf vx = v4sfl (x);
      assert (v4sf_index (vfastexp (vx), 0) >= 0);
      assert (v4sf_index (vfasterexp (vx), 0) >= 0);
#endif
    }

  srand48 (69);

  strncpy (buf, argv[0], sizeof (buf) - 5);
  strncat (buf, ".out", 5);

  fclose (stderr);
  stderr = fopen (buf, "w");


  test_fastexp ();
  test_fasterexp ();
  test_vfastexp ();
  test_vfasterexp ();

  time_fastexp ();
  time_fasterexp ();
  time_vfastexp ();
  time_vfasterexp ();

  return 0;
}
Esempio n. 3
0
int main() {
	
	a = exp(a);
	b = expf(b);
	c = fastexp(c);
	d = fasterexp(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = log(a);
	b = logf(b);
	c = fastlog(c);
	d = fasterlog(c);
	printf("%f %f %f %f\n", a, b, c, d);	
	
	a = pow(a,a);
	b = pow(b,b);
	c = fastpow(c,c);
	d = fasterpow(c,c);
	printf("%f %f %f %f\n", a, b, c, d);			

	
	a = sin(a);
	b = sinf(b);
	c = fastsin(c);
	d = fastersin(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = cos(a);
	b = cosf(b);
	c = fastcos(c);
	d = fastercos(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = tan(a);
	b = tanf(b);
	c = fasttan(c);
	d = fastertan(c);
	printf("%f %f %f %f\n", a, b, c, d);	
	
	a = asin(a);
	b = asinf(b);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = acos(a);
	b = acosf(b);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = atan(a);
	b = atanf(b);
	printf("%f %f %f %f\n", a, b, c, d);	
	
	a = sinh(a);
	b = sinhf(b);
	c = fastsinh(c);
	d = fastersinh(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = cosh(a);
	b = coshf(b);
	c = fastcosh(c);
	d = fastercosh(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = tanh(a);
	b = tanhf(b);
	c = fasttanh(c);
	d = fastertanh(c);
	printf("%f %f %f %f\n", a, b, c, d);		
	
	a = lgamma(a);
	b = lgammaf(b);
	c = fastlgamma(c);
	d = fasterlgamma(c);
	printf("%f %f %f %f\n", a, b, c, d);		
	
	return 0;
	
}