Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.23 KB | None | 0 0
  1. double tan_fce(double x,unsigned int N,unsigned int M)
  2. {
  3.  
  4.         double tan = tan_math(x);               //výsledek z math
  5.         double rtaylor = taylor_tan(x,N);       //výsledek z taylor_tan
  6.         double TE;                              //abs. chyba Taylora
  7.         double rcfrac = cfrac_tan(x,N);         //výsledek z cfrac_tan
  8.         double CE;                              //abs. chyba cfrac
  9.  
  10. //      TE = tan - rtaylor;
  11. //      CE = tan - rcfrac;
  12.  
  13.         if(M>13)
  14.         {
  15.                 fprintf(stderr,"Zadejte maximálně 13 iterací\n");
  16.                 return EXIT_FAILURE;
  17.         }
  18.  
  19.         else
  20.         {
  21.                 for(;N<=M;N++)
  22.                 {
  23.  
  24.                         tan = tan_math(x);
  25.                         rtaylor = taylor_tan(x,N);
  26.                         rcfrac = cfrac_tan(x,N);
  27.  
  28.                 TE = tan - rtaylor;
  29.                         if(TE<0)
  30.                 {
  31.                         TE *= -1;
  32.                 }
  33.  
  34.                 CE = tan - rcfrac;
  35.                         if(CE<0)
  36.                 {
  37.                         CE *= -1;
  38.                 }
  39.  
  40.                 printf("%d %.6e %.6e %.6e %.6e %.6e\n",N,tan,rtaylor,TE,rcfrac,CE);
  41.                 }
  42.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement