Graphics: fix test 12399 (bug introduced in commit 65ea2594be544746ba8998f934df6b38d4... 09/14009/3
Calixte DENIZET [Thu, 13 Mar 2014 13:58:44 +0000 (14:58 +0100)]
Change-Id: If9bf657f59b711ec3c38811a259de65babf2fefe

scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/graphics.vcxproj
scilab/modules/graphics/src/c/BasicAlgos.c
scilab/modules/graphics/src/c/Plo2dn.c

index 9087df0..4237bee 100644 (file)
@@ -475,6 +475,7 @@ libscigraphics_la_CPPFLAGS = \
        -I$(top_srcdir)/modules/output_stream/includes/ \
        -I$(top_srcdir)/modules/renderer/includes/ \
        -I$(top_srcdir)/modules/string/includes/ \
+       -I$(top_srcdir)/modules/sparse/includes/ \
        $(AM_CPPFLAGS)
 
 libscigraphics_algo_la_SOURCES = $(GRAPHICS_C_SOURCES) $(GRAPHICS_CXX_SOURCES)
index 8ea33de..8039b91 100644 (file)
@@ -1419,6 +1419,7 @@ libscigraphics_la_CPPFLAGS = \
        -I$(top_srcdir)/modules/output_stream/includes/ \
        -I$(top_srcdir)/modules/renderer/includes/ \
        -I$(top_srcdir)/modules/string/includes/ \
+       -I$(top_srcdir)/modules/sparse/includes/ \
        $(AM_CPPFLAGS)
 
 libscigraphics_algo_la_SOURCES = $(GRAPHICS_C_SOURCES) $(GRAPHICS_CXX_SOURCES)
index e7bf627..d2ff920 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../sparse/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -109,7 +109,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../sparse/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -135,7 +135,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../sparse/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -169,7 +169,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     </Midl>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes/handleDrawing;includes;src/c;src/c/getHandleProperty;../../java/jdk/include;../../java/jdk/include/win32;../elementary_functions/includes;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../graphic_objects/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../sparse/includes;../windows_tools/includes;../api_scilab/includes;../../libs/intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
index a358e7a..df309ad 100644 (file)
 #include "MALLOC.h"
 #include "core_math.h"
 #include "freeArrayOfString.h"
+
+#define spINSIDE_SPARSE
+#include "spConfig.h" // NAN definition
 /*------------------------------------------------------------------------*/
 double sciFindStPosMin(const double x[], int n)
 {
     double min = -1.0;
     int i = 0;
+    char hasNeg = 0;
 
     if (n <= 0)
     {
@@ -39,6 +43,16 @@ double sciFindStPosMin(const double x[], int n)
             min = x[i];
             break;
         }
+        else if (!hasNeg && x[i] <= 0)
+        {
+            hasNeg = 1;
+        }
+    }
+
+    if (i == n && !hasNeg)
+    {
+        // we have only NaN
+        return NAN;
     }
 
     for (; i < n ; i++)
index 5d21939..f350217 100644 (file)
@@ -583,7 +583,7 @@ void compute_data_bounds2(int cflag, char dataflag, char *logflags, double *x, d
     }
 
     /* back to default values for  x=[] and y = [] */
-    if (drect[2] == LARGEST_REAL || drect[3] == -LARGEST_REAL)
+    if (drect[2] == LARGEST_REAL || drect[3] == -LARGEST_REAL || isnan(drect[2]) || isnan(drect[3]))
     {
         if (logflags[1] != 'l')
         {
@@ -597,7 +597,7 @@ void compute_data_bounds2(int cflag, char dataflag, char *logflags, double *x, d
         drect[3] = 10.0;
     }
 
-    if (drect[0] == LARGEST_REAL || drect[1] == -LARGEST_REAL)
+    if (drect[0] == LARGEST_REAL || drect[1] == -LARGEST_REAL || isnan(drect[0]) || isnan(drect[1]))
     {
         if (logflags[0] != 'l')
         {