diff options
Diffstat (limited to 'src/auxiliaryFunctions')
-rw-r--r-- | src/auxiliaryFunctions/includes/isnan.h | 30 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/cisnana.c | 22 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/cisnans.c | 5 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/disnana.c | 22 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/disnans.c | 4 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/sisnana.c | 22 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/sisnans.c | 4 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/testIsNan.h | 8 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/zisnana.c | 22 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isnan/zisnans.c | 2 |
10 files changed, 130 insertions, 11 deletions
diff --git a/src/auxiliaryFunctions/includes/isnan.h b/src/auxiliaryFunctions/includes/isnan.h index 91796d2b..3a73e47f 100644 --- a/src/auxiliaryFunctions/includes/isnan.h +++ b/src/auxiliaryFunctions/includes/isnan.h @@ -22,20 +22,42 @@ /* ** \brief Float Is Nan function */ -bool sisnans(float x); +float sisnans(float x); /* ** \brief Double Is Nan function */ -bool disnans(double x); +double disnans(double x); /* ** \brief Float Complex Is Nan function */ -bool cisnans(floatComplex z); +float cisnans(floatComplex z); /* ** \brief Double Complex Is Nan function */ -bool zisnans(doubleComplex z); +double zisnans(doubleComplex z); + +/* +** \brief Float Is Nan function +*/ +void sisnana(float x, int size, float* out); + +/* +** \brief Double Is Nan function +*/ +void disnana(double x, int size, double* out); + +/* +** \brief Float Complex Is Nan function +*/ +void cisnana(floatComplex z, int size, float* out); + +/* +** \brief Double Complex Is Nan function +*/ +void zisnana(doubleComplex z, int size, double* out); + + #endif /* !__IS_NAN_H__ */ diff --git a/src/auxiliaryFunctions/isnan/cisnana.c b/src/auxiliaryFunctions/isnan/cisnana.c new file mode 100644 index 00000000..0048400a --- /dev/null +++ b/src/auxiliaryFunctions/isnan/cisnana.c @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "isnan.h" + + +void cisnana(floatComplex* in, int size, float* out){ + int i=0; + + for (i=0;i<size;i++) out[i] = cisnans(in[i]); + +} + diff --git a/src/auxiliaryFunctions/isnan/cisnans.c b/src/auxiliaryFunctions/isnan/cisnans.c index 6594499c..527ff21a 100644 --- a/src/auxiliaryFunctions/isnan/cisnans.c +++ b/src/auxiliaryFunctions/isnan/cisnans.c @@ -12,6 +12,7 @@ #include "isnan.h" -bool cisnans(floatComplex in) { - return (isnan(creals(in)) || isnan(cimags(in))); +float cisnans(floatComplex in) { + if ((int)(isnan(creals(in))) && (int)(isnan(cimags(in)))) return 1; + return 0; } diff --git a/src/auxiliaryFunctions/isnan/disnana.c b/src/auxiliaryFunctions/isnan/disnana.c new file mode 100644 index 00000000..ad556fd8 --- /dev/null +++ b/src/auxiliaryFunctions/isnan/disnana.c @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "isnan.h" + + +void disnana(double* in, int size, double* out){ + int i=0; + + for (i=0;i<size;i++) out[i] = disnans(in[i]); + +} + diff --git a/src/auxiliaryFunctions/isnan/disnans.c b/src/auxiliaryFunctions/isnan/disnans.c index b8746100..981cbae4 100644 --- a/src/auxiliaryFunctions/isnan/disnans.c +++ b/src/auxiliaryFunctions/isnan/disnans.c @@ -12,7 +12,7 @@ #include "isnan.h" -bool disnans(double in) { - return isnan(in); +double disnans(double in) { + return isnan(in) ? 1 : 0; } diff --git a/src/auxiliaryFunctions/isnan/sisnana.c b/src/auxiliaryFunctions/isnan/sisnana.c new file mode 100644 index 00000000..31574376 --- /dev/null +++ b/src/auxiliaryFunctions/isnan/sisnana.c @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "isnan.h" + + +void sisnana(float* in, int size, float* out){ + int i=0; + + for (i=0;i<size;i++) out[i] = sisnans(in[i]); + +} + diff --git a/src/auxiliaryFunctions/isnan/sisnans.c b/src/auxiliaryFunctions/isnan/sisnans.c index fd561c71..cd646cd8 100644 --- a/src/auxiliaryFunctions/isnan/sisnans.c +++ b/src/auxiliaryFunctions/isnan/sisnans.c @@ -12,7 +12,7 @@ #include "isnan.h" -bool sisnans(float in) { - return isnan(in); +float sisnans(float in) { + return isnan(in) ? (float)1 :(float)0; } diff --git a/src/auxiliaryFunctions/isnan/testIsNan.h b/src/auxiliaryFunctions/isnan/testIsNan.h index 9bcc4306..ee34db84 100644 --- a/src/auxiliaryFunctions/isnan/testIsNan.h +++ b/src/auxiliaryFunctions/isnan/testIsNan.h @@ -27,6 +27,14 @@ int cisnansTest(void); int zisnansTest(void); +int sisnanaTest(void); + +int disnanaTest(void); + +int cisnanaTest(void); + +int zisnanaTest(void); + int testIsNan(void); #endif /* ! __TESTISNAN_H__ */ diff --git a/src/auxiliaryFunctions/isnan/zisnana.c b/src/auxiliaryFunctions/isnan/zisnana.c new file mode 100644 index 00000000..a6a65596 --- /dev/null +++ b/src/auxiliaryFunctions/isnan/zisnana.c @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "isnan.h" + + +void zisnana(doubleComplex* in, int size, double* out){ + int i=0; + + for (i=0;i<size;i++) out[i] = zisnans(in[i]); + +} + diff --git a/src/auxiliaryFunctions/isnan/zisnans.c b/src/auxiliaryFunctions/isnan/zisnans.c index 72964356..a2b1a0a4 100644 --- a/src/auxiliaryFunctions/isnan/zisnans.c +++ b/src/auxiliaryFunctions/isnan/zisnans.c @@ -12,6 +12,6 @@ #include "isnan.h" -bool zisnans(doubleComplex in) { +double zisnans(doubleComplex in) { return (isnan(zreals(in)) || isnan(zimags(in))); } |