Skip to content

Commit

Permalink
Improve testing harness reports; improve and; improve cir
Browse files Browse the repository at this point in the history
  • Loading branch information
arcfide committed Jul 18, 2017
1 parent dbf1d20 commit 6b239db
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
Binary file modified codfns.dws
Binary file not shown.
11 changes: 6 additions & 5 deletions ra.c
Expand Up @@ -38,10 +38,11 @@ using namespace af;
typedef enum{APLNC=0,APLU8,APLTI,APLSI,APLI,APLD}APLTYPE;
typedef long long L;typedef int I;typedef int16_t S16;
typedef int8_t S8;typedef double D;typedef unsigned char U8;
typedef dim_t B;typedef unsigned U;typedef void V;
typedef std::string STR;
typedef dim_t B;typedef unsigned U;typedef void V;typedef std::string STR;
S{U f=3;U n;U x=0;wchar_t*v=L"Co-dfns";wchar_t*m;V*c;}dmx;
S lp{S{L l;B c;U t:4;U r:4;U e:4;U _:13;U _1:16;U _2:16;B s[1];}*p;};
S dwa{B sz;S{B sz;V*(*ga)(U,U,B*,S lp*);V(*na[5])(V);V(*er)(U);}*ws;V*na[4];};
S dwa*dwafns;Z V derr(U n){dwafns->ws->er(n);}Z V err(U n){throw n;}
S dwa{B z;S{B z;V*(*ga)(U,U,B*,S lp*);V(*p[16])(V);V(*er)(V*);}*ws;V*p[4];};
S dwa*dwafns;Z V derr(U n){dmx.n=n;dwafns->ws->er(&dmx);}
Z V err(U n,wchar_t*m){dmx.m=m;throw n;}Z V err(U n){dmx.m=L"";throw n;}
EXPORT I DyalogGetInterpreterFunctions(dwa*p){
if(p)dwafns=p;else R 0;if(dwafns->sz<sizeof(S dwa))R 16;R 0;}
if(p)dwafns=p;else R 0;if(dwafns->z<sizeof(S dwa))R 16;R 0;}
13 changes: 11 additions & 2 deletions re.c
@@ -1,6 +1,8 @@
MF(add_f){z=r;}
SF(add_f,z.v=lv+rv)
SF(and_f,if(lv.isbool()&&rv.isbool())z.v=lv&&rv;else err(16);)
SF(and_f,if(lv.isbool()&&rv.isbool())z.v=lv&&rv;
else if(allTrue<I>(lv>=0&&lv<=1&&rv>0&&rv<=1))z.v=lv&&rv;
else err(16,L"Dyadic AND over non-boolean datatype");)
MF(brk_f){err(16);}
DF(brk_f){if(l.r!=1)err(16);
z.r=r.r;z.s=r.s;z.v=l.v(r.v.as(s32));}
Expand Down Expand Up @@ -38,4 +40,11 @@ SF(cir_f,array fv=rv.as(f64);
CS(-3,z.v=atan(fv))CS(-4,z.v=(fv+1)*sqrt((fv-1)/(fv+1)))
CS(-5,z.v=asinh(fv))CS(-6,z.v=acosh(fv))CS(-7,z.v=atanh(fv))
CS(-8,z.v=-sqrt(fv*fv-1))CS(-9,z.v=fv)CS(-10,z.v=fv)}R;}
err(16);)
if(anyTrue<I>(abs(lv)>10))err(16);
z.v=(!lv)*sqrt(1-fv*fv)+(lv==1)*sin(fv)+(lv==2)*cos(fv)+(lv==3)*tan(fv);
z.v+=(lv==4)*sqrt(1+fv*fv)+(lv==5)*sinh(fv)+(lv==6)*cosh(fv);
z.v+=(lv==7)*tanh(fv)+(lv==8)*sqrt(fv*fv-1)+(lv==9)*fv+(lv==10)*abs(fv);
z.v+=(lv==-1)*asin(fv)+(lv==-2)*acos(fv)+(lv==-3)*atan(fv);
z.v+=(lv==-4)*(fv+1)*sqrt((fv-1)/(fv+1))+(lv==-5)*asinh(fv);
z.v+=(lv==-6)*acosh(fv)+(lv==-7)*atanh(fv)+(lv==-8)*-sqrt(fv*fv-1);
z.v+=(lv==-9)*fv+(lv==-10)*fv;z.v=z.v.as(f64);)
2 changes: 1 addition & 1 deletion ut.dyalog
Expand Up @@ -304,7 +304,7 @@
:EndIf

:Else
Z(DM)1
Z(DMX.(Vendor EM Message))1
:If exception
expectexception
Z[2]0
Expand Down

0 comments on commit 6b239db

Please sign in to comment.