version 1.1, 2000/12/22 10:03:28 |
version 1.5, 2009/03/27 14:42:29 |
|
|
/* |
/* |
* $OpenXM: $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/t-itv.c,v 1.4 2003/10/20 07:18:42 saito Exp $ |
*/ |
*/ |
#if defined(INTERVAL) |
#if defined(INTERVAL) |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
#if PARI |
#if defined(PARI) |
#include "genpari.h" |
#include "genpari.h" |
#endif |
#endif |
|
|
Line 50 void additvp(Itv a, Itv b, Itv *c) |
|
Line 50 void additvp(Itv a, Itv b, Itv *c) |
|
addnum(0,a,b,c); |
addnum(0,a,b,c); |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
additvd((Num)a,(Num)b,(ItvD *)c); |
additvd((Num)a,(Num)b,(IntervalDouble *)c); |
else { |
else { |
itvtois(a,&ai,&as); |
itvtois(a,&ai,&as); |
itvtois(b,&bi,&bs); |
itvtois(b,&bi,&bs); |
Line 73 void subitvp(Itv a, Itv b, Itv *c) |
|
Line 73 void subitvp(Itv a, Itv b, Itv *c) |
|
subnum(0,a,b,c); |
subnum(0,a,b,c); |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
subitvd((Num)a,(Num)b,(ItvD *)c); |
subitvd((Num)a,(Num)b,(IntervalDouble *)c); |
else { |
else { |
itvtois(a,&ai,&as); |
itvtois(a,&ai,&as); |
itvtois(b,&bi,&bs); |
itvtois(b,&bi,&bs); |
Line 94 void mulitvp(Itv a, Itv b, Itv *c) |
|
Line 94 void mulitvp(Itv a, Itv b, Itv *c) |
|
mulnum(0,a,b,c); |
mulnum(0,a,b,c); |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
mulitvd((Num)a,(Num)b,(ItvD *)c); |
mulitvd((Num)a,(Num)b,(IntervalDouble *)c); |
else { |
else { |
itvtois(a,&ai,&as); |
itvtois(a,&ai,&as); |
itvtois(b,&bi,&bs); |
itvtois(b,&bi,&bs); |
Line 176 void divitvp(Itv a, Itv b, Itv *c) |
|
Line 176 void divitvp(Itv a, Itv b, Itv *c) |
|
divnum(0,a,b,c); |
divnum(0,a,b,c); |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
else if ( (NID(a) == N_IP) && (NID(b) == N_R ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
||(NID(a) == N_R ) && (NID(b) == N_IP) ) |
divitvd((Num)a,(Num)b,(ItvD *)c); |
divitvd((Num)a,(Num)b,(IntervalDouble *)c); |
else { |
else { |
itvtois(a,&ai,&as); |
itvtois(a,&ai,&as); |
itvtois(b,&bi,&bs); |
itvtois(b,&bi,&bs); |
Line 227 void pwritvp(Itv a, Num e, Itv *c) |
|
Line 227 void pwritvp(Itv a, Num e, Itv *c) |
|
else if ( NID(a) <= N_B ) |
else if ( NID(a) <= N_B ) |
pwrnum(0,a,e,c); |
pwrnum(0,a,e,c); |
else if ( !INT(e) ) { |
else if ( !INT(e) ) { |
#if PARI && 0 |
#if defined(PARI) && 0 |
GEN pa,pe,z; |
gpui_ri((Obj)a,(Obj)c,(Obj *)c); |
int ltop,lbot; |
|
|
|
ltop = avma; ritopa(a,&pa); ritopa(e,&pe); lbot = avma; |
|
z = gerepile(ltop,lbot,gpui(pa,pe,prec)); |
|
patori(z,c); cgiv(z); |
|
#else |
#else |
error("pwritv : can't calculate a fractional power"); |
error("pwritv : can't calculate a fractional power"); |
#endif |
#endif |
Line 330 void miditvp(Itv a, Num *b) |
|
Line 325 void miditvp(Itv a, Num *b) |
|
{ |
{ |
Num ai,as; |
Num ai,as; |
Num t; |
Num t; |
Q TWO; |
|
|
|
if ( ! a ) *b = 0; |
if ( ! a ) *b = 0; |
else if ( (NID(a) <= N_B) ) |
else if ( (NID(a) <= N_B) ) |