version 1.1, 2000/12/22 10:03:28 |
version 1.2, 2002/01/08 04:14:37 |
|
|
/* |
/* |
* $OpenXM: $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/f-itv.c,v 1.1 2000/12/22 10:03:28 saito Exp $ |
*/ |
*/ |
#if defined(INTERVAL) |
#if defined(INTERVAL) |
#include "ca.h" |
#include "ca.h" |
Line 94 void getulp(BF a, BF *au) |
|
Line 94 void getulp(BF a, BF *au) |
|
cgiv(b); |
cgiv(b); |
} |
} |
|
|
void addulp(ItvF a, ItvF *c) |
void addulp(IntervalBigFloat a, IntervalBigFloat *c) |
{ |
{ |
Num ai, as, aiu, asu, inf, sup; |
Num ai, as, aiu, asu, inf, sup; |
|
|
Line 110 void addulp(ItvF a, ItvF *c) |
|
Line 110 void addulp(ItvF a, ItvF *c) |
|
istoitv(inf,sup, (Itv *)c); |
istoitv(inf,sup, (Itv *)c); |
} |
} |
|
|
void additvf(ItvF a, ItvF b, ItvF *c) |
void additvf(IntervalBigFloat a, IntervalBigFloat b, IntervalBigFloat *c) |
{ |
{ |
Num ai,as,bi,bs,mas,mbs,tmp; |
Num ai,as,bi,bs,mas,mbs,tmp; |
Num inf,sup; |
Num inf,sup; |
Line 139 printexpr(CO, bs); |
|
Line 139 printexpr(CO, bs); |
|
addnum(0,ai,bi,&inf); |
addnum(0,ai,bi,&inf); |
addnum(0,as,bs,&sup); |
addnum(0,as,bs,&sup); |
istoitv(inf,sup,(Itv *)&tmp); |
istoitv(inf,sup,(Itv *)&tmp); |
addulp((ItvF)tmp, c); |
addulp((IntervalBigFloat)tmp, c); |
return; |
return; |
#else |
#else |
ltop = avma; |
ltop = avma; |
Line 167 printexpr(CO, bs); |
|
Line 167 printexpr(CO, bs); |
|
} |
} |
} |
} |
|
|
void subitvf(ItvF a, ItvF b, ItvF *c) |
void subitvf(IntervalBigFloat a, IntervalBigFloat b, IntervalBigFloat *c) |
{ |
{ |
Num ai,as,bi,bs,mas, mbs; |
Num ai,as,bi,bs,mas, mbs; |
Num inf,sup,tmp; |
Num inf,sup,tmp; |
Line 189 void subitvf(ItvF a, ItvF b, ItvF *c) |
|
Line 189 void subitvf(ItvF a, ItvF b, ItvF *c) |
|
subnum(0,ai,bs,&inf); |
subnum(0,ai,bs,&inf); |
subnum(0,as,bi,&sup); |
subnum(0,as,bi,&sup); |
istoitv(inf,sup,(Itv *)&tmp); |
istoitv(inf,sup,(Itv *)&tmp); |
addulp((ItvF)tmp, c); |
addulp((IntervalBigFloat)tmp, c); |
#else |
#else |
|
|
/* MUST check if ai, as, bi, bs are bigfloat. */ |
/* MUST check if ai, as, bi, bs are bigfloat. */ |
Line 217 void subitvf(ItvF a, ItvF b, ItvF *c) |
|
Line 217 void subitvf(ItvF a, ItvF b, ItvF *c) |
|
} |
} |
} |
} |
|
|
void mulitvf(ItvF a, ItvF b, ItvF *c) |
void mulitvf(IntervalBigFloat a, IntervalBigFloat b, IntervalBigFloat *c) |
{ |
{ |
Num ai,as,bi,bs,a1,a2,b1,b2,c1,c2,p,t,tmp; |
Num ai,as,bi,bs,a1,a2,b1,b2,c1,c2,p,t,tmp; |
Num inf, sup; |
Num inf, sup; |
Line 278 void mulitvf(ItvF a, ItvF b, ItvF *c) |
|
Line 278 void mulitvf(ItvF a, ItvF b, ItvF *c) |
|
subnum(0,0,c1,&t); |
subnum(0,0,c1,&t); |
istoitv(c2,t,(Itv *)&tmp); |
istoitv(c2,t,(Itv *)&tmp); |
} |
} |
addulp((ItvF)tmp, c); |
addulp((IntervalBigFloat)tmp, c); |
} |
} |
} |
} |
|
|
Line 302 int itvinitvf(Itv a, Itv b) |
|
Line 302 int itvinitvf(Itv a, Itv b) |
|
else return 0; |
else return 0; |
} |
} |
|
|
void divitvf(ItvF a, ItvF b, ItvF *c) |
void divitvf(IntervalBigFloat a, IntervalBigFloat b, IntervalBigFloat *c) |
{ |
{ |
Num ai,as,bi,bs,a1,a2,b1,b2,c1,c2,t,tmp; |
Num ai,as,bi,bs,a1,a2,b1,b2,c1,c2,t,tmp; |
Num inf, sup; |
Num inf, sup; |
Line 352 void divitvf(ItvF a, ItvF b, ItvF *c) |
|
Line 352 void divitvf(ItvF a, ItvF b, ItvF *c) |
|
subnum(0,0,c1,&t); |
subnum(0,0,c1,&t); |
istoitv(c2,t,(Itv *)&tmp); |
istoitv(c2,t,(Itv *)&tmp); |
} |
} |
addulp((ItvF)tmp, c); |
addulp((IntervalBigFloat)tmp, c); |
} |
} |
} |
} |
|
|
Line 392 void pwritv0f(Itv a, int e, Itv *c) |
|
Line 392 void pwritv0f(Itv a, int e, Itv *c) |
|
{ |
{ |
Num inf, sup; |
Num inf, sup; |
Num ai,Xmin,Xmax; |
Num ai,Xmin,Xmax; |
ItvF tmp; |
IntervalBigFloat tmp; |
Q ne; |
Q ne; |
|
|
if ( e == 1 ) |
if ( e == 1 ) |
Line 426 void pwritv0f(Itv a, int e, Itv *c) |
|
Line 426 void pwritv0f(Itv a, int e, Itv *c) |
|
if ( ! Xmax ) sup = 0; |
if ( ! Xmax ) sup = 0; |
else pwrbf(Xmax,(Num)ne,&sup); |
else pwrbf(Xmax,(Num)ne,&sup); |
istoitv(inf,sup,(Itv *)&tmp); |
istoitv(inf,sup,(Itv *)&tmp); |
addulp(tmp, (ItvF *)c); |
addulp(tmp, (IntervalBigFloat *)c); |
} |
} |
} |
} |
|
|
Line 463 int cmpitvf(Itv a, Itv b) |
|
Line 463 int cmpitvf(Itv a, Itv b) |
|
} else { |
} else { |
itvtois(a,&ai,&as); |
itvtois(a,&ai,&as); |
itvtois(b,&bi,&bs); |
itvtois(b,&bi,&bs); |
s = compnum(0,ai,bi); |
s = compnum(0,ai,bs) ; |
t = compnum(0,as,bs); |
t = compnum(0,bi,as) ; |
if ( !s && !t ) return 0; |
if ( s > 0 ) return 1; |
else return -1; |
else if ( t > 0 ) return -1; |
|
else return 0; |
} |
} |
} |
} |
|
|