version 1.3, 2003/02/14 22:29:09 |
version 1.6, 2005/02/08 18:06:05 |
|
|
/* |
/* |
* $OpenXM: OpenXM_contrib2/asir2000/engine/p-itv.c,v 1.2 2002/01/08 04:14:37 kondoh Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/p-itv.c,v 1.5 2003/10/20 07:18:42 saito Exp $ |
*/ |
*/ |
#if defined(INTERVAL) |
#if defined(INTERVAL) |
#include "ca.h" |
#include "ca.h" |
Line 50 void istoitv(Num inf, Num sup, Itv *rp) |
|
Line 50 void istoitv(Num inf, Num sup, Itv *rp) |
|
} else { |
} else { |
i = inf; |
i = inf; |
} |
} |
if ( type ) |
if ( type ) { |
NEWIntervalBigFloat((IntervalBigFloat)c); |
// NEWIntervalBigFloat((IntervalBigFloat)c); |
else |
c=MALLOC(sizeof(struct oIntervalBigFloat)); |
|
OID(c)=O_N; |
|
NID(c)=N_IntervalBigFloat; |
|
} else |
NEWItvP(c); |
NEWItvP(c); |
|
|
if ( compnum(0,i,s) >= 0 ) { |
if ( compnum(0,i,s) >= 0 ) { |
Line 339 int cmpitvp(Itv a, Itv b) |
|
Line 342 int cmpitvp(Itv a, Itv b) |
|
int s,t; |
int s,t; |
|
|
if ( !a ) { |
if ( !a ) { |
if ( !b || (NID(b)<=N_B) ) |
if ( !b || (NID(b)<=N_B) ) { |
return compnum(0,(Num)a,(Num)b); |
return compnum(0,(Num)a,(Num)b); |
else |
} else { |
return -1; |
itvtois(b,&bi,&bs); |
|
if ( compnum(0,(Num)a,bs) > 0 ) return 1; |
|
else if ( compnum(0,bi,(Num)a) > 0 ) return -1; |
|
else return 0; |
|
} |
} else if ( !b ) { |
} else if ( !b ) { |
if ( !a || (NID(a)<=N_B) ) |
if ( !a || (NID(a)<=N_B) ) { |
return compnum(0,(Num)a,(Num)b); |
return compnum(0,(Num)a,(Num)b); |
else |
} else { |
return initvp((Num)b,a); |
itvtois(a,&ai,&as); |
|
if ( compnum(0,ai,(Num)b) > 0 ) return 1; |
|
else if ( compnum(0,(Num)b,as) > 0 ) return -1; |
|
else return 0; |
|
} |
} else { |
} else { |
itvtois(a,&ai,&as); |
itvtois(a,&ai,&as); |
itvtois(b,&bi,&bs); |
itvtois(b,&bi,&bs); |
Line 363 void miditvp(Itv a, Num *b) |
|
Line 374 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) ) |