version 1.10, 2001/10/09 01:36:06 |
version 1.11, 2002/07/12 08:05:23 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/parif.c,v 1.9 2001/10/03 01:47:30 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/parif.c,v 1.10 2001/10/09 01:36:06 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 60 void patori_i(GEN,N *); |
|
Line 60 void patori_i(GEN,N *); |
|
void ritopa(Obj,GEN *); |
void ritopa(Obj,GEN *); |
void ritopa_i(N,int,GEN *); |
void ritopa_i(N,int,GEN *); |
|
|
|
void Ptodouble(); |
void Peval(),Psetprec(),p_pi(),p_e(),p_mul(),p_gcd(); |
void Peval(),Psetprec(),p_pi(),p_e(),p_mul(),p_gcd(); |
void asir_cgiv(GEN); |
void asir_cgiv(GEN); |
|
|
Line 70 void Psetprecword(); |
|
Line 71 void Psetprecword(); |
|
struct ftab pari_tab[] = { |
struct ftab pari_tab[] = { |
{"eval",Peval,-2}, |
{"eval",Peval,-2}, |
{"setprec",Psetprec,-1}, |
{"setprec",Psetprec,-1}, |
|
{"todouble",Ptodouble,1}, |
#if defined(INTERVAL) || 1 |
#if defined(INTERVAL) || 1 |
{"setprecword",Psetprecword,-1}, |
{"setprecword",Psetprecword,-1}, |
#endif |
#endif |
|
|
if ( p <= 0 ) |
if ( p <= 0 ) |
p = 1; |
p = 1; |
return (int)(p*PREC_CONV+3); |
return (int)(p*PREC_CONV+3); |
|
} |
|
|
|
void Ptodouble(arg,rp) |
|
NODE arg; |
|
Num *rp; |
|
{ |
|
double r,i; |
|
Real real,imag; |
|
Num num; |
|
|
|
asir_assert(ARG0(arg),O_N,"todouble"); |
|
num = (Num)ARG0(arg); |
|
if ( !num ) { |
|
*rp = 0; |
|
return; |
|
} |
|
switch ( NID(num) ) { |
|
case N_R: case N_Q: case N_B: |
|
r = ToReal(num); |
|
MKReal(r,real); |
|
*rp = (Num)real; |
|
break; |
|
case N_C: |
|
r = ToReal(((C)num)->r); |
|
i = ToReal(((C)num)->i); |
|
MKReal(r,real); |
|
MKReal(i,imag); |
|
reimtocplx((Num)real,(Num)imag,rp); |
|
break; |
|
default: |
|
*rp = num; |
|
break; |
|
} |
} |
} |
|
|
void Peval(arg,rp) |
void Peval(arg,rp) |