Mercurial > forge
diff extra/NaN/src/sumskipnan_mex.cpp @ 8232:49c1c23128ea octave-forge
use only single test for (D1==1)
author | schloegl |
---|---|
date | Wed, 27 Jul 2011 22:20:09 +0000 |
parents | 6a419bec96bb |
children | 903fbabbd5fe |
line wrap: on
line diff
--- a/extra/NaN/src/sumskipnan_mex.cpp Wed Jul 27 15:51:50 2011 +0000 +++ b/extra/NaN/src/sumskipnan_mex.cpp Wed Jul 27 22:20:09 2011 +0000 @@ -186,9 +186,10 @@ mxFree(SZ2); - if (D1*D2*D3<1) // zero size array + if (!D1 || !D2 || !D3) // zero size array ; // do nothing - else if ((D1==1) && (ACC_LEVEL<1)) { + else if (D1==1) { + if (ACC_LEVEL<1) { // double accuray, naive summation, error = N*2^-52 switch (POutputCount) { case 1: @@ -211,8 +212,8 @@ } break; } - } - else if ((D1==1) && (ACC_LEVEL==1)) { + } + else if (ACC_LEVEL==1) { // extended accuray, naive summation, error = N*2^-64 switch (POutputCount) { case 1: @@ -235,8 +236,8 @@ } break; } - } - else if ((D1==1) && (ACC_LEVEL==3)) { + } + else if (ACC_LEVEL==3) { // ACC_LEVEL==3: extended accuracy and Kahan Summation, error = 2^-64 switch (POutputCount) { case 1: @@ -259,8 +260,8 @@ } break; } - } - else if ((D1==1) && (ACC_LEVEL==2)) { + } + else if (ACC_LEVEL==2) { // ACC_LEVEL==2: double accuracy and Kahan Summation, error = 2^-52 switch (POutputCount) { case 1: @@ -283,6 +284,7 @@ } break; } + } } else if (POutputCount <= 1) { // OUTER LOOP: along dimensions > DIM