eltst.c 689 B

12345678910111213141516171819202122232425262728293031323334353637
  1. extern double MACHEP, PIO2, PI;
  2. double ellie(), ellpe(), floor(), fabs();
  3. double ellie2();
  4. main()
  5. {
  6. double y, m, phi, e, E, phipi, y1;
  7. int i, j, npi;
  8. /* dprec(); */
  9. m = 0.9;
  10. E = ellpe(0.1);
  11. for( j=-10; j<=10; j++ )
  12. {
  13. printf( "%d * PIO2\n", j );
  14. for( i=-2; i<=2; i++ )
  15. {
  16. phi = PIO2 * j + 50 * MACHEP * i;
  17. npi = floor(phi/PIO2);
  18. if( npi & 1 )
  19. npi += 1;
  20. phipi = phi - npi * PIO2;
  21. npi = floor(phi/PIO2);
  22. if( npi & 1 )
  23. npi += 1;
  24. phipi = phi - npi * PIO2;
  25. printf( "phi %.9e npi %d ", phi, npi );
  26. y1 = E * npi + ellie(phipi,m);
  27. y = ellie2( phi, m );
  28. printf( "y %.9e ", y );
  29. e = fabs(y - y1);
  30. if( y1 != 0.0 )
  31. e /= y1;
  32. printf( "e %.4e\n", e );
  33. }
  34. }
  35. }