summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortorset2009-02-03 08:59:23 +0000
committertorset2009-02-03 08:59:23 +0000
commit690c37203144bce5cbfa77897a7302497affa6c5 (patch)
treec5ac0e384e5740593d83ce75296b27aedf19334c /src
parentf34494b429d07006a7ba64b59e5f6be339990ee4 (diff)
downloadscilab2c-690c37203144bce5cbfa77897a7302497affa6c5.tar.gz
scilab2c-690c37203144bce5cbfa77897a7302497affa6c5.tar.bz2
scilab2c-690c37203144bce5cbfa77897a7302497affa6c5.zip
Update
Diffstat (limited to 'src')
-rw-r--r--src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci14
-rw-r--r--src/auxiliaryFunctions/includes/isnan.h8
-rw-r--r--src/auxiliaryFunctions/interfaces/int_isempty.h12
-rw-r--r--src/elementaryFunctions/atanh/testDoubleAtanh.c4
-rw-r--r--src/elementaryFunctions/cosh/testDoubleCosh.c13
-rw-r--r--src/elementaryFunctions/interfaces/int_atan.h30
-rw-r--r--src/elementaryFunctions/sinh/testDoubleSinh.c20
7 files changed, 63 insertions, 38 deletions
diff --git a/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci
index 967341ef..7509073c 100644
--- a/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci
+++ b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci
@@ -2,16 +2,16 @@
function mainfunction()
-//test asinh
+//test length
-disp (asinh(7));
-disp (asinh(2+11*%i))
+disp(length(4));
+disp(length(3+%i*4));
-c=[4 2 3 ;8 8 4; 3 4 5]
-d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5]
+c=[1 5 4 8; 2 9 4 5; 3 6 4 7]
+d=[1 5+%i*4 4 8+%i; 2-%i*3 9+%i*7 4+%i*2 5; 3 6 4 7-%i; 3 6 4 7-%i]
-disp (asinh(c))
-disp (asinh(d))
+disp(length(c));
+disp(length(d));
endfunction
diff --git a/src/auxiliaryFunctions/includes/isnan.h b/src/auxiliaryFunctions/includes/isnan.h
index 3a73e47f..889328bd 100644
--- a/src/auxiliaryFunctions/includes/isnan.h
+++ b/src/auxiliaryFunctions/includes/isnan.h
@@ -42,22 +42,22 @@ double zisnans(doubleComplex z);
/*
** \brief Float Is Nan function
*/
-void sisnana(float x, int size, float* out);
+void sisnana(float* x, int size, float* out);
/*
** \brief Double Is Nan function
*/
-void disnana(double x, int size, double* out);
+void disnana(double* x, int size, double* out);
/*
** \brief Float Complex Is Nan function
*/
-void cisnana(floatComplex z, int size, float* out);
+void cisnana(floatComplex* z, int size, float* out);
/*
** \brief Double Complex Is Nan function
*/
-void zisnana(doubleComplex z, int size, double* out);
+void zisnana(doubleComplex* z, int size, double* out);
#endif /* !__IS_NAN_H__ */
diff --git a/src/auxiliaryFunctions/interfaces/int_isempty.h b/src/auxiliaryFunctions/interfaces/int_isempty.h
index 4f7c8889..403bc56e 100644
--- a/src/auxiliaryFunctions/interfaces/int_isempty.h
+++ b/src/auxiliaryFunctions/interfaces/int_isempty.h
@@ -19,16 +19,16 @@
#define d0isemptyd0(in) disemptys(in)
-#define c0isemptyc0(in) cisemptys(in)
+#define c0isemptys0(in) cisemptys(in)
-#define z0isemptyz0(in) zisemptys(in)
+#define z0isemptyd0(in) zisemptys(in)
-#define s2isemptys0(in,size,out) sisemptya(in, size[0]*size[1])
+#define s2isemptys0(in,size) sisemptya(in, size[0]*size[1])
-#define d2isemptyd0(in,size,out) disemptya(in, size[0]*size[1])
+#define d2isemptyd0(in,size) disemptya(in, size[0]*size[1])
-#define c2isemptyc0(in,size,out) cisemptya(in, size[0]*size[1])
+#define c2isemptys0(in,size) cisemptya(in, size[0]*size[1])
-#define z2isemptyz0(in,size,out) zisemptya(in, size[0]*size[1])
+#define z2isemptyd0(in,size) zisemptya(in, size[0]*size[1])
#endif /* !__INT_ISEMPTY_H__ */
diff --git a/src/elementaryFunctions/atanh/testDoubleAtanh.c b/src/elementaryFunctions/atanh/testDoubleAtanh.c
index a876ed33..62f383fe 100644
--- a/src/elementaryFunctions/atanh/testDoubleAtanh.c
+++ b/src/elementaryFunctions/atanh/testDoubleAtanh.c
@@ -550,6 +550,10 @@ void zatanhsTest() {
assert( ( (fabs(zreals(out)-resR[i])) / (fabs(zreals(out))) ) <1e-15);
assert( ( (fabs(zimags(out)-resI[i])) / (fabs(zimags(out))) ) <1e-15);
}
+ out=zatanhs((DoubleComplex(2.0/10.0,11.0/10.0)));
+ assert( ( (fabs(zreals(out)-0.0898435002269743487879)) / (fabs(zreals(out))) ) <1e-15);
+ assert( ( (fabs(zimags(out)-0.8419736541926906570055)) / (fabs(zimags(out))) ) <1e-16);
+
}
void datanhaTest(void) {
diff --git a/src/elementaryFunctions/cosh/testDoubleCosh.c b/src/elementaryFunctions/cosh/testDoubleCosh.c
index dda3ba6c..72ab788f 100644
--- a/src/elementaryFunctions/cosh/testDoubleCosh.c
+++ b/src/elementaryFunctions/cosh/testDoubleCosh.c
@@ -456,11 +456,22 @@ void dcoshaTest(void) {
double res[]=RESULT;
double out[200];
int i;
-
+ double mon_test[9]={1,8,3,2,8,4,3,4,5};
+ double mon_res[9]={1.5430806348152437124099,1490.4791612521778461087,10.06766199577776710328,
+ 3.7621956910836313880964,1490.4791612521778461087,27.308232836016486544395,
+ 10.06766199577776710328,27.308232836016486544395,74.209948524787861856566};
+ double mon_out[9];
dcosha(in,200,out);
+
+ dcosha(mon_test,9,mon_out);
+
for (i=0;i<200;i++){
assert(( (fabs(out[i]-res[i]))/(fabs(out[i])) )<1e-15);
}
+
+ for (i=0;i<9;i++){
+ assert(( (fabs(mon_out[i]-mon_res[i]))/(fabs(mon_out[i])) )<1e-15);
+ }
}
void zcoshaTest(void) {
diff --git a/src/elementaryFunctions/interfaces/int_atan.h b/src/elementaryFunctions/interfaces/int_atan.h
index 6b0883d4..ad87e675 100644
--- a/src/elementaryFunctions/interfaces/int_atan.h
+++ b/src/elementaryFunctions/interfaces/int_atan.h
@@ -15,36 +15,30 @@
#ifndef __INT_ATAN_H__
#define __INT_ATAN_H__
-#define s0atans0(in) satans(in)
+#define s0atans0(in) satans(in)
-#define d0atand0(in) datans(in)
+#define d0atand0(in) datans(in)
-#define c0atanc0(in) catans(in)
+#define c0atanc0(in) catans(in)
-#define z0atanz0(in) zatans(in)
+#define z0atanz0(in) zatans(in)
-#define s2atans2(in,size,out) satana(in, size[0]*size[1], out)
+#define s2atans2(in,size,out) satana(in, size[0]*size[1], out)
-#define d2atand2(in,size,out) datana(in, size[0]*size[1], out)
+#define d2atand2(in,size,out) datana(in, size[0]*size[1], out)
-#define c2atanc2(in,size,out) catana(in, size[0]*size[1], out)
+#define c2atanc2(in,size,out) catana(in, size[0]*size[1], out)
-#define z2atanz2(in,size,out) zatana(in, size[0]*size[1], out)
+#define z2atanz2(in,size,out) zatana(in, size[0]*size[1], out)
-#define s0s0atans0(in1, in2) satan2s(in1, in2)
+#define s0s0atans0(in1, in2) satan2s(in1, in2)
-#define d0d0atand0(in1, in2) datan2s(in1, in2)
+#define d0d0atand0(in1, in2) datan2s(in1, in2)
-#define c0c0atanc0(in1, in2) catan2s(in1, in2)
+#define s2s2atans2(in1,size1, in2, size2, out) satan2a(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out)
-#define z0z0atanz0(in1, in2) zatan2s(in1, in2)
+#define d2d2atand2(in1, size1, in2,size2, out) datan2a(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out)
-#define s2s2atans2(in1, in2, out) satan2a(in1, in2, out)
-#define d2d2atand2(in1, in2, out) datan2a(in1, in2, out)
-
-#define c2c2atanc2(in1, in2, out) catan2a(in1, in2, out)
-
-#define z2z2atanz2(in1, in2, out) zatan2a(in1, in2, out)
#endif /* !__INT_ATAN_H__ */
diff --git a/src/elementaryFunctions/sinh/testDoubleSinh.c b/src/elementaryFunctions/sinh/testDoubleSinh.c
index cdc7b867..4848e225 100644
--- a/src/elementaryFunctions/sinh/testDoubleSinh.c
+++ b/src/elementaryFunctions/sinh/testDoubleSinh.c
@@ -469,8 +469,18 @@ void zsinhaTest(void) {
double resI[]=ZRESULTI;
doubleComplex *in,out[200];
int i;
-
-
+ double mon_testR[9]={1,8,3,2,8,4,3,4,5};
+ double mon_testI[9]={0,0,4,0,-1,0,3,0,0};
+ double mon_resR[9]={1.1752011936438013783857,1490.4788257895500009909,- 6.548120040911003414408,
+ 3.6268604078470190188455,805.30914642173127049318,27.289917197127749659558,
+ - 9.9176210100175374861919,27.289917197127749659558,74.203210577788766499907};
+ double mon_resI[9]={0,0,- 7.6192317203214106058340,
+ 0,- 1254.1949676545177680964,0,
+ 1.4207485419881773491824,0,0};
+ doubleComplex* mon_test;
+ doubleComplex mon_out[9];
+
+mon_test=DoubleComplexMatrix(mon_testR,mon_testI,9);
in=DoubleComplexMatrix(inR,inI,200);
zsinha(in,200,out);
@@ -478,6 +488,12 @@ void zsinhaTest(void) {
assert(( (fabs(zreals(out[i])-resR[i]))/(fabs(zreals(out[i]))) )<1e-15);
assert(( (fabs(zimags(out[i])-resI[i]))/(fabs(zimags(out[i]))) )<1e-15);
}
+ zsinha(mon_test,9,mon_out);
+ for (i=0;i<9;i++){
+ printf("%f + %f*i\n",zreals(mon_out[i]),zimags(mon_out[i]));
+ assert(( (fabs(zreals(mon_out[i])-mon_resR[i]))/(fabs(zreals(mon_out[i]))) )<1e-15);
+ if (zimags(mon_out[i])!=0) assert(( (fabs(zimags(mon_out[i])-mon_resI[i]))/(fabs(zimags(mon_out[i]))) )<1e-15);
+ }
}
int testSinh() {