version 1.1, 2018/09/19 05:45:06 |
version 1.3, 2019/11/12 10:53:22 |
|
|
* 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: OpenXM_contrib2/asir2018/builtin/pf.c,v 1.2 2018/09/28 08:20:27 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "math.h" |
#include "math.h" |
Line 128 void pf_init() { |
|
Line 128 void pf_init() { |
|
darg[0] = &oVAR[26]; |
darg[0] = &oVAR[26]; |
darg[1] = &oVAR[27]; MKV(darg[1],y); |
darg[1] = &oVAR[27]; MKV(darg[1],y); |
|
|
|
#if defined(INTERVAL) |
|
mkpf("@pi",0,0,0,(int (*)())mp_pi,const_pi,simplify_elemfunc_ins,pi_itv_ft,&pidef); |
|
mkpf("@e",0,0,0,(int (*)())mp_e,const_e,simplify_elemfunc_ins,e_itv_ft,&edef); |
|
|
|
mkpf("factorial",0,1,uarg,(int (*)())mp_factorial,double_factorial,simplify_factorial_ins,0,&factorialdef); |
|
mkpf("abs",0,1,uarg,(int (*)())mp_abs,fabs,simplify_abs_ins,abs_itv_ft,&absdef); |
|
|
|
mkpf("log",0,1,uarg,(int (*)())mp_log,log,simplify_elemfunc_ins,log_itv_ft,&logdef); |
|
mkpf("exp",0,1,uarg,(int (*)())mp_exp,exp,simplify_elemfunc_ins,exp_itv_ft,&expdef); |
|
mkpf("pow",0,2,darg,(int (*)())mp_pow,pow,(int (*)())simplify_pow,pow_itv_ft,&powdef); |
|
|
|
mkpf("sin",0,1,uarg,(int (*)())mp_sin,sin,simplify_elemfunc_ins,sin_itv_ft,&sindef); |
|
mkpf("cos",0,1,uarg,(int (*)())mp_cos,cos,simplify_elemfunc_ins,cos_itv_ft,&cosdef); |
|
mkpf("tan",0,1,uarg,(int (*)())mp_tan,tan,simplify_elemfunc_ins,tan_itv_ft,&tandef); |
|
mkpf("asin",0,1,uarg,(int (*)())mp_asin,asin,simplify_elemfunc_ins,asin_itv_ft,&asindef); |
|
mkpf("acos",0,1,uarg,(int (*)())mp_acos,acos,simplify_elemfunc_ins,acos_itv_ft,&acosdef); |
|
mkpf("atan",0,1,uarg,(int (*)())mp_atan,atan,simplify_elemfunc_ins,atan_itv_ft,&atandef); |
|
|
|
mkpf("sinh",0,1,uarg,(int (*)())mp_sinh,sinh,simplify_elemfunc_ins,sinh_itv_ft,&sinhdef); |
|
mkpf("cosh",0,1,uarg,(int (*)())mp_cosh,cosh,simplify_elemfunc_ins,cosh_itv_ft,&coshdef); |
|
mkpf("tanh",0,1,uarg,(int (*)())mp_tanh,tanh,simplify_elemfunc_ins,tanh_itv_ft,&tanhdef); |
|
#if !defined(VISUAL) && !defined(__MINGW32__) |
|
mkpf("asinh",0,1,uarg,(int (*)())mp_asinh,asinh,simplify_elemfunc_ins,asinh_itv_ft,&asinhdef); |
|
mkpf("acosh",0,1,uarg,(int (*)())mp_acosh,acosh,simplify_elemfunc_ins,acosh_itv_ft,&acoshdef); |
|
mkpf("atanh",0,1,uarg,(int (*)())mp_atanh,atanh,simplify_elemfunc_ins,atanh_itv_ft,&atanhdef); |
|
#endif |
|
#else |
mkpf("@pi",0,0,0,(int (*)())mp_pi,const_pi,simplify_elemfunc_ins,&pidef); |
mkpf("@pi",0,0,0,(int (*)())mp_pi,const_pi,simplify_elemfunc_ins,&pidef); |
mkpf("@e",0,0,0,(int (*)())mp_e,const_e,simplify_elemfunc_ins,&edef); |
mkpf("@e",0,0,0,(int (*)())mp_e,const_e,simplify_elemfunc_ins,&edef); |
|
|
Line 153 void pf_init() { |
|
Line 180 void pf_init() { |
|
mkpf("acosh",0,1,uarg,(int (*)())mp_acosh,acosh,simplify_elemfunc_ins,&acoshdef); |
mkpf("acosh",0,1,uarg,(int (*)())mp_acosh,acosh,simplify_elemfunc_ins,&acoshdef); |
mkpf("atanh",0,1,uarg,(int (*)())mp_atanh,atanh,simplify_elemfunc_ins,&atanhdef); |
mkpf("atanh",0,1,uarg,(int (*)())mp_atanh,atanh,simplify_elemfunc_ins,&atanhdef); |
#endif |
#endif |
|
#endif |
make_exp(); |
make_exp(); |
make_tri(); |
make_tri(); |
make_itri(); |
make_itri(); |
Line 216 void make_itri() { |
|
Line 244 void make_itri() { |
|
OALLOC(asindef->deriv,1); |
OALLOC(asindef->deriv,1); |
args = (Obj *)ALLOCA(2*sizeof(Obj)); |
args = (Obj *)ALLOCA(2*sizeof(Obj)); |
mulp(CO,x,x,&xx); subp(CO,(P)ONE,xx,(P *)&args[0]); |
mulp(CO,x,x,&xx); subp(CO,(P)ONE,xx,(P *)&args[0]); |
STOQ(-2,mtwo); divz(ONE,mtwo,(Z *)&args[1]); |
STOZ(-2,mtwo); divz(ONE,mtwo,(Z *)&args[1]); |
_mkpfins(powdef,args,&v); MKV(v,t); |
_mkpfins(powdef,args,&v); MKV(v,t); |
asindef->deriv[0] = (Obj)t; |
asindef->deriv[0] = (Obj)t; |
|
|
Line 257 void make_ihyp() { |
|
Line 285 void make_ihyp() { |
|
OALLOC(asinhdef->deriv,1); |
OALLOC(asinhdef->deriv,1); |
args = (Obj *)ALLOCA(2*sizeof(Obj)); |
args = (Obj *)ALLOCA(2*sizeof(Obj)); |
mulp(CO,x,x,&xx); addp(CO,(P)ONE,xx,(P *)&args[0]); |
mulp(CO,x,x,&xx); addp(CO,(P)ONE,xx,(P *)&args[0]); |
STOQ(-2,mtwo); divz(ONE,mtwo,(Z *)&args[1]); |
STOZ(-2,mtwo); divz(ONE,mtwo,(Z *)&args[1]); |
_mkpfins(powdef,args,&v); MKV(v,t); |
_mkpfins(powdef,args,&v); MKV(v,t); |
asinhdef->deriv[0] = (Obj)t; |
asinhdef->deriv[0] = (Obj)t; |
|
|
Line 415 void Pfunargs_ext(NODE arg,LIST *rp) |
|
Line 443 void Pfunargs_ext(NODE arg,LIST *rp) |
|
|
|
d0 = a0 = 0; |
d0 = a0 = 0; |
for ( i = 0; i < pf->argc; i++ ) { |
for ( i = 0; i < pf->argc; i++ ) { |
NEXTNODE(d0,d); STOQ(ad[i].d,q); BDY(d) = (pointer)q; |
NEXTNODE(d0,d); STOZ(ad[i].d,q); BDY(d) = (pointer)q; |
NEXTNODE(a0,a); BDY(a) = (pointer)ad[i].arg; |
NEXTNODE(a0,a); BDY(a) = (pointer)ad[i].arg; |
} |
} |
NEXT(d) = 0; NEXT(a) = 0; MKLIST(alist,a0); MKLIST(dlist,d0); |
NEXT(d) = 0; NEXT(a) = 0; MKLIST(alist,a0); MKLIST(dlist,d0); |
Line 433 void Pvtype(NODE arg,Z *rp) |
|
Line 461 void Pvtype(NODE arg,Z *rp) |
|
if ( !p || ID(p) != O_P ) |
if ( !p || ID(p) != O_P ) |
*rp = 0; |
*rp = 0; |
else |
else |
STOQ((long)VR(p)->attr,*rp); |
STOZ((long)VR(p)->attr,*rp); |
} |
} |
|
|
extern NODE user_int_handler,user_quit_handler; |
extern NODE user_int_handler,user_quit_handler; |
Line 618 void Pmapat(NODE arg,Obj *rp) |
|
Line 646 void Pmapat(NODE arg,Obj *rp) |
|
error("mapat : invalid function specification"); |
error("mapat : invalid function specification"); |
if ( !INT(ARG1(arg)) ) |
if ( !INT(ARG1(arg)) ) |
error("mapat : invalid position"); |
error("mapat : invalid position"); |
pos = QTOS((Q)ARG1(arg)); |
pos = ZTOS((Q)ARG1(arg)); |
node = NEXT(NEXT(arg)); |
node = NEXT(NEXT(arg)); |
len = length(node); |
len = length(node); |
if ( pos >= len ) |
if ( pos >= len ) |