[BACK]Return to convert.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_pari

Diff for /OpenXM/src/ox_pari/convert.c between version 1.1 and 1.4

version 1.1, 2015/08/21 01:20:30 version 1.4, 2017/02/22 04:53:13
Line 162  cmo_qq *GEN_to_cmo_qq(GEN z)
Line 162  cmo_qq *GEN_to_cmo_qq(GEN z)
   den = (GEN)z[2];    den = (GEN)z[2];
   c = new_cmo_qq();    c = new_cmo_qq();
   mpz_import(mpq_numref(c->mpq),lgef(num)-2,1,sizeof(long),0,0,&num[2]);    mpz_import(mpq_numref(c->mpq),lgef(num)-2,1,sizeof(long),0,0,&num[2]);
   mpz_import(mpq_denref(c->mpq),lgef(num)-2,1,sizeof(long),0,0,&den[2]);    mpz_import(mpq_denref(c->mpq),lgef(den)-2,1,sizeof(long),0,0,&den[2]);
   if ( signe(num)*signe(den) < 0 )    if ( signe(num)*signe(den) < 0 )
     mpz_neg(mpq_numref(c->mpq),mpq_numref(c->mpq));      mpz_neg(mpq_numref(c->mpq),mpq_numref(c->mpq));
   return c;    return c;
Line 184  cmo_bf *GEN_to_cmo_bf(GEN z)
Line 184  cmo_bf *GEN_to_cmo_bf(GEN z)
     ptr[j] = z[len-j+1];      ptr[j] = z[len-j+1];
   MPFR_EXP(c->mpfr) = (long long)(expo(z)+1);    MPFR_EXP(c->mpfr) = (long long)(expo(z)+1);
   MPFR_SIGN(c->mpfr) = gsigne(z);    MPFR_SIGN(c->mpfr) = gsigne(z);
     if ( !mpfr_sgn(c->mpfr) ) c = (cmo_bf *)new_cmo_zero();
   return c;    return c;
 }  }
   
Line 206  cmo_list *GEN_to_cmo_list(GEN z)
Line 207  cmo_list *GEN_to_cmo_list(GEN z)
 cmo_complex *GEN_to_cmo_complex(GEN z)  cmo_complex *GEN_to_cmo_complex(GEN z)
 {  {
   cmo_complex *c;    cmo_complex *c;
     cmo_bf *re,*im;
   
   c = new_cmo_complex();    re = (cmo_bf *)GEN_to_cmo((GEN)z[1]);
   c->re = GEN_to_cmo((GEN)z[1]);    im = (cmo_bf *)GEN_to_cmo((GEN)z[2]);
   c->im = GEN_to_cmo((GEN)z[2]);    if ( im->tag == CMO_ZERO )
   return c;      return (cmo_complex *)re;
     else {
       c = new_cmo_complex();
       c->re = (cmo *)re; c->im = (cmo *)im;
       return c;
     }
 }  }
   
 cmo_polynomial_in_one_variable *GEN_to_cmo_up(GEN z)  cmo_polynomial_in_one_variable *GEN_to_cmo_up(GEN z)
Line 251  GEN cmo_to_GEN(cmo *c)
Line 258  GEN cmo_to_GEN(cmo *c)
     return cmo_complex_to_GEN((cmo_complex *)c);      return cmo_complex_to_GEN((cmo_complex *)c);
   case CMO_IEEE_DOUBLE_FLOAT:    case CMO_IEEE_DOUBLE_FLOAT:
      return dbltor(((cmo_double *)c)->d);       return dbltor(((cmo_double *)c)->d);
   case CMO_BIGFLOAT: /* bigfloat */    case CMO_BIGFLOAT32: /* bigfloat */
     return cmo_bf_to_GEN((cmo_bf *)c);      return cmo_bf_to_GEN((cmo_bf *)c);
   case CMO_LIST:    case CMO_LIST:
     return cmo_list_to_GEN((cmo_list *)c);      return cmo_list_to_GEN((cmo_list *)c);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>