"Fossies" - the Fresh Open Source Software Archive

Member "pari-2.13.1/src/test/in/trans2" (4 Jan 2021, 2435 Bytes) of package /linux/misc/pari-2.13.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "trans2": 2.13.0_vs_2.13.1.

    1 OVERFLOW_EXPONENT=if(sizebyte(0)==16, 2^50, 2^20);
    2 default(realprecision,38);
    3 default(parisize,20*10^6);
    4 exp(quadgen(5))
    5 exp(Mod(x,x^2+1))
    6 iferr(exp(""),E,E)
    7 N=2^64;
    8 O(2^0)^N
    9 iferr(O(2^0)^-N,E,E)
   10 0^N
   11 Pol(1)^N
   12 (8+O(x^2))^(1/3)
   13 (8+O(x^2))^(1/2)
   14 sqrt(Mod(1,y)*(1+x+O(x^2)))
   15 sqrt(4+x+O(x^2))
   16 iferr(O(x)^0.5,E,E)
   17 O(1)^0.5
   18 (1+x+O(x^2))^0.5
   19 iferr(O(x)^((2^65)/3),E,E)
   20 iferr(""^0,E,E)
   21 iferr(0^Mod(1,3),E,E)
   22 N=2^16; y=x^N;
   23 y^3
   24 iferr(y^OVERFLOW_EXPONENT,E,E)
   25 iferr(0.^(2.^64),E,E)
   26 agm(1,1)
   27 agm(-1,1)
   28 agm(1+x+O(x^10),1)
   29 agm(1,[1,2])
   30 log(4+O(3^4))
   31 
   32 obj=[Mod(1,3), O(3^5), 3 + O(3^5),I];
   33 test(f,p)=print(iferr(f(p),E,E));
   34 [test(f,p) | f<-[exp,log,cos,sin,tan,cotan];p<-obj];
   35 tan(1+I)
   36 tan(-127336279536511925./2^49)
   37 cotan(2)
   38 asin(1+O(x^3))
   39 asin(-1+O(x^3))
   40 asinh(I+O(x^3))
   41 asinh(-I+O(x^3))
   42 acosh(1+O(x^3))
   43 acosh(1+x^2+O(x^3))
   44 acosh(2+x+O(x^3))
   45 acos(1+O(x^3))
   46 sinh(I)
   47 tan(1+10^18*I)
   48 tan(1-10^18*I)
   49 cotan(1+10^18*I)
   50 cotan(1-10^18*I)
   51 w=Pi/4;
   52 test(z)= my(a=expm1(z),b=exp(z)-1); printf("%.1e\n", abs(a-b)/abs(a));
   53 for (i=0,7, z=1e-20+i*w; test(z))
   54 for (i=0,7, z=1e-20+i*w+I; test(z))
   55 erfc(1/2+I)
   56 erfc(-1/2+I)
   57 expm1(3+O(3^2))
   58 expm1(x)
   59 expm1(O(x))
   60 expm1(1e-20+x+O(x^2))
   61 expm1(3/4)
   62 expm1(1)
   63 forstep(x=1, 1+2*Pi, Pi/2, if(abs(expm1(I*x)-exp(I*x)+1) > 1e-38,print(x)))
   64 
   65 log1p(x + O(x^5))
   66 log1p(1e-10 + x + O(x^5))
   67 log1p(O(x))
   68 log1p(1/10^10)
   69 log1p(1e-10)
   70 log1p(1e-20)
   71 log1p(1e-10*(1+I))
   72 log1p(1e-20*(1+I))
   73 log1p(2+O(5^3))
   74 
   75 a=-1633048355459347662258066616498.+ 107206003159399666971219664801296.*I;
   76 acosh(a)
   77 asinh(a)
   78 
   79 localprec(1310); precision(imag(cos(Pi*(1+I/2^2048)))) >= 1310
   80 
   81 localprec(1000); abs(sinh(1e-500)-1e-500) < 2e-1500
   82 
   83 sinc(0)
   84 sinc(1/2)
   85 sinc(10*I)
   86 sinc(1+I)
   87 sinc(O(3^2))
   88 sinc(3+O(3^4))
   89 sinc(2+O(3^2))
   90 sinc(x)
   91 sinc(1/x)
   92 sinc(0.*I)
   93 sinc(O(3^4)*I)
   94 sinc((1+O(3^3)) * x)
   95 sinc(Pi * x)
   96 
   97 localprec(2003); log(exp(1.5)) - 1.5
   98 
   99 localbitprec(320); obj=[1.2, 2.1*I, 1+1.1*I];
  100 {
  101   fun=[exp,expm1,log,arg,
  102        cos,sin,tan,cotan,sinc,
  103        cosh,sinh,tanh,cotanh,
  104        acos,asin,atan,
  105        acosh,asinh,atanh,
  106        sqrt,x->sqrtn(x,3),
  107        gamma,lngamma,psi,zeta];
  108   for (i=1, #fun,
  109     my (f = fun[i]);
  110     print1(f,": " ); print([bitprecision(f(p)) | p<-obj]));
  111 }
  112 
  113 tst(f, z) =
  114 {
  115   localbitprec(64); a = f(z * 1.);
  116   localbitprec(128);b = f(z * 1.); exponent(b/a - 1);
  117 }
  118 z = -0xffffffffffffffd6 / 2^64; tst(atanh,z)
  119 z = -0xffffffffffffffeb / 2^64; tst(atanh,z)
  120 z = 0x1000000000000004 / 2^60; tst(acosh,z)
  121 z = 0x33bc6d3d39ebfccc8 / 2^56; tst(tan,z)