add a class to store dlamch constant 97/17097/5
Antoine ELIAS [Mon, 10 Aug 2015 10:31:05 +0000 (12:31 +0200)]
Change-Id: I25f1a19aa701f9c4460aa1a0aca58ef4879dc567

48 files changed:
scilab/modules/ast/Makefile.am
scilab/modules/ast/Makefile.in
scilab/modules/ast/ast.vcxproj
scilab/modules/ast/ast.vcxproj.filters
scilab/modules/ast/includes/system_env/numericconstants.hxx [new file with mode: 0644]
scilab/modules/ast/includes/system_env/numericconstants_interface.h [new file with mode: 0644]
scilab/modules/ast/src/c/operations/invert_matrix.c
scilab/modules/ast/src/c/operations/matrix_addition.c
scilab/modules/ast/src/c/operations/matrix_division.c
scilab/modules/ast/src/c/operations/matrix_multiplication.c
scilab/modules/ast/src/cpp/system_env/numericconstants.cpp [new file with mode: 0644]
scilab/modules/ast/src/cpp/system_env/numericconstants_interface.cpp [new file with mode: 0644]
scilab/modules/ast/src/cpp/types/implicitlist.cpp
scilab/modules/cacsd/sci_gateway/c/sci_contr.c
scilab/modules/cacsd/sci_gateway/c/sci_dhinf.c
scilab/modules/cacsd/sci_gateway/c/sci_hinf.c
scilab/modules/cacsd/sci_gateway/cpp/sci_freq.cpp
scilab/modules/cacsd/sci_gateway/cpp/sci_ppol.cpp
scilab/modules/cacsd/sci_gateway/cpp/sci_residu.cpp
scilab/modules/cacsd/sci_gateway/cpp/sci_tzer.cpp
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/differential_equations/src/c/Ex-daskr.c
scilab/modules/elementary_functions/includes/elem_common.h
scilab/modules/elementary_functions/sci_gateway/c/sci_number_properties.c
scilab/modules/elementary_functions/sci_gateway/cpp/elem_func_gw.cpp
scilab/modules/elementary_functions/src/c/expm.c
scilab/modules/elementary_functions/src/c/tan.c
scilab/modules/graphics/src/c/Format.c
scilab/modules/linear_algebra/src/c/linear_algebra.vcxproj
scilab/modules/linear_algebra/src/c/lsq.c
scilab/modules/linear_algebra/src/c/qr.c
scilab/modules/linear_algebra/src/c/svd.c
scilab/modules/linear_algebra/src/cpp/scischur.cpp
scilab/modules/mpi/mpi.vcxproj
scilab/modules/optimization/sci_gateway/c/sci_qld.c
scilab/modules/optimization/sci_gateway/cpp/sci_optim.cpp
scilab/modules/optimization/sci_gateway/cpp/sci_readmps.cpp
scilab/modules/optimization/src/c/sp.c
scilab/modules/polynomials/sci_gateway/cpp/sci_poly.cpp
scilab/modules/scicos_blocks/src/c/cli/scicos_blocks-cli.vcxproj
scilab/modules/scicos_blocks/src/c/mat_bksl.c
scilab/modules/scicos_blocks/src/c/mat_div.c
scilab/modules/scicos_blocks/src/c/matz_bksl.c
scilab/modules/scicos_blocks/src/c/matz_div.c
scilab/modules/scicos_blocks/src/c/scicos_blocks.vcxproj
scilab/modules/sparse/sci_gateway/cpp/sci_lufact.cpp
scilab/modules/sparse/sci_gateway/cpp/sci_lusolve.cpp
scilab/modules/special_functions/src/c/zbeshv.c

index db9f531..a05231d 100644 (file)
@@ -68,6 +68,8 @@ src/cpp/system_env/sci_path.cpp \
 src/cpp/system_env/sci_tmpdir.cpp \
 src/cpp/system_env/setenvvar.cpp \
 src/cpp/system_env/threadmanagement.cpp \
+src/cpp/system_env/numericconstants.cpp \
+src/cpp/system_env/numericconstants_interface.cpp \
 src/cpp/types/addfunction.cpp \
 src/cpp/types/arrayof.cpp \
 src/cpp/types/bool.cpp \
index e9cc6d5..07ba894 100644 (file)
@@ -220,6 +220,8 @@ am__libsciast_la_SOURCES_DIST = src/c/operations/doublecomplex.c \
        src/cpp/system_env/sci_tmpdir.cpp \
        src/cpp/system_env/setenvvar.cpp \
        src/cpp/system_env/threadmanagement.cpp \
+       src/cpp/system_env/numericconstants.cpp \
+       src/cpp/system_env/numericconstants_interface.cpp \
        src/cpp/types/addfunction.cpp src/cpp/types/arrayof.cpp \
        src/cpp/types/bool.cpp src/cpp/types/callable.cpp \
        src/cpp/types/cell.cpp src/cpp/types/double.cpp \
@@ -296,6 +298,8 @@ am_libsciast_la_OBJECTS =  \
        src/cpp/system_env/libsciast_la-sci_tmpdir.lo \
        src/cpp/system_env/libsciast_la-setenvvar.lo \
        src/cpp/system_env/libsciast_la-threadmanagement.lo \
+       src/cpp/system_env/libsciast_la-numericconstants.lo \
+       src/cpp/system_env/libsciast_la-numericconstants_interface.lo \
        src/cpp/types/libsciast_la-addfunction.lo \
        src/cpp/types/libsciast_la-arrayof.lo \
        src/cpp/types/libsciast_la-bool.lo \
@@ -753,6 +757,8 @@ libsciast_la_SOURCES = src/c/operations/doublecomplex.c \
        src/cpp/system_env/sci_tmpdir.cpp \
        src/cpp/system_env/setenvvar.cpp \
        src/cpp/system_env/threadmanagement.cpp \
+       src/cpp/system_env/numericconstants.cpp \
+       src/cpp/system_env/numericconstants_interface.cpp \
        src/cpp/types/addfunction.cpp src/cpp/types/arrayof.cpp \
        src/cpp/types/bool.cpp src/cpp/types/callable.cpp \
        src/cpp/types/cell.cpp src/cpp/types/double.cpp \
@@ -1354,6 +1360,12 @@ src/cpp/system_env/libsciast_la-setenvvar.lo:  \
 src/cpp/system_env/libsciast_la-threadmanagement.lo:  \
        src/cpp/system_env/$(am__dirstamp) \
        src/cpp/system_env/$(DEPDIR)/$(am__dirstamp)
+src/cpp/system_env/libsciast_la-numericconstants.lo:  \
+       src/cpp/system_env/$(am__dirstamp) \
+       src/cpp/system_env/$(DEPDIR)/$(am__dirstamp)
+src/cpp/system_env/libsciast_la-numericconstants_interface.lo:  \
+       src/cpp/system_env/$(am__dirstamp) \
+       src/cpp/system_env/$(DEPDIR)/$(am__dirstamp)
 src/cpp/types/$(am__dirstamp):
        @$(MKDIR_P) src/cpp/types
        @: > src/cpp/types/$(am__dirstamp)
@@ -1517,6 +1529,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-dynamic_module.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-home.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-lasterror.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants_interface.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-sci_home.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-sci_path.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-sci_tmpdir.Plo@am__quote@
@@ -1984,6 +1998,20 @@ src/cpp/system_env/libsciast_la-threadmanagement.lo: src/cpp/system_env/threadma
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/system_env/libsciast_la-threadmanagement.lo `test -f 'src/cpp/system_env/threadmanagement.cpp' || echo '$(srcdir)/'`src/cpp/system_env/threadmanagement.cpp
 
+src/cpp/system_env/libsciast_la-numericconstants.lo: src/cpp/system_env/numericconstants.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/system_env/libsciast_la-numericconstants.lo -MD -MP -MF src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants.Tpo -c -o src/cpp/system_env/libsciast_la-numericconstants.lo `test -f 'src/cpp/system_env/numericconstants.cpp' || echo '$(srcdir)/'`src/cpp/system_env/numericconstants.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants.Tpo src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/system_env/numericconstants.cpp' object='src/cpp/system_env/libsciast_la-numericconstants.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/system_env/libsciast_la-numericconstants.lo `test -f 'src/cpp/system_env/numericconstants.cpp' || echo '$(srcdir)/'`src/cpp/system_env/numericconstants.cpp
+
+src/cpp/system_env/libsciast_la-numericconstants_interface.lo: src/cpp/system_env/numericconstants_interface.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/system_env/libsciast_la-numericconstants_interface.lo -MD -MP -MF src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants_interface.Tpo -c -o src/cpp/system_env/libsciast_la-numericconstants_interface.lo `test -f 'src/cpp/system_env/numericconstants_interface.cpp' || echo '$(srcdir)/'`src/cpp/system_env/numericconstants_interface.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants_interface.Tpo src/cpp/system_env/$(DEPDIR)/libsciast_la-numericconstants_interface.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/system_env/numericconstants_interface.cpp' object='src/cpp/system_env/libsciast_la-numericconstants_interface.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/system_env/libsciast_la-numericconstants_interface.lo `test -f 'src/cpp/system_env/numericconstants_interface.cpp' || echo '$(srcdir)/'`src/cpp/system_env/numericconstants_interface.cpp
+
 src/cpp/types/libsciast_la-addfunction.lo: src/cpp/types/addfunction.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/types/libsciast_la-addfunction.lo -MD -MP -MF src/cpp/types/$(DEPDIR)/libsciast_la-addfunction.Tpo -c -o src/cpp/types/libsciast_la-addfunction.lo `test -f 'src/cpp/types/addfunction.cpp' || echo '$(srcdir)/'`src/cpp/types/addfunction.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/types/$(DEPDIR)/libsciast_la-addfunction.Tpo src/cpp/types/$(DEPDIR)/libsciast_la-addfunction.Plo
index 653e2f7..be92d27 100644 (file)
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
-    <LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
+    <IncludePath>$(IncludePath)</IncludePath>
+    <LibraryPath>$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
-    <LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
+    <IncludePath>$(IncludePath)</IncludePath>
+    <LibraryPath>$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
-    <LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
+    <IncludePath>$(IncludePath)</IncludePath>
+    <LibraryPath>$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
-    <LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
+    <IncludePath>$(IncludePath)</IncludePath>
+    <LibraryPath>$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -375,6 +375,8 @@ lib /DEF:"$(ProjectDir)string_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform
     <ClInclude Include="includes\system_env\dynamic_module.h" />
     <ClInclude Include="includes\system_env\home.h" />
     <ClInclude Include="includes\system_env\lasterror.h" />
+    <ClInclude Include="includes\system_env\numericconstants_interface.h" />
+    <ClInclude Include="includes\system_env\numericconstants.hxx" />
     <ClInclude Include="includes\system_env\sci_home.h" />
     <ClInclude Include="includes\system_env\sci_path.h" />
     <ClInclude Include="includes\system_env\sci_tmpdir.h" />
@@ -470,6 +472,8 @@ lib /DEF:"$(ProjectDir)string_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform
     <ClCompile Include="src\cpp\system_env\dynamic_module.cpp" />
     <ClCompile Include="src\cpp\system_env\home.cpp" />
     <ClCompile Include="src\cpp\system_env\lasterror.cpp" />
+    <ClCompile Include="src\cpp\system_env\numericconstants.cpp" />
+    <ClCompile Include="src\cpp\system_env\numericconstants_interface.cpp" />
     <ClCompile Include="src\cpp\system_env\sci_home.cpp" />
     <ClCompile Include="src\cpp\system_env\sci_path.cpp" />
     <ClCompile Include="src\cpp\system_env\sci_tmpdir.cpp" />
index aa0c8e4..c64bc2d 100644 (file)
     <ClInclude Include="includes\system_env\threadmanagement.hxx">
       <Filter>Header Files\system_env</Filter>
     </ClInclude>
+    <ClInclude Include="includes\system_env\numericconstants.hxx">
+      <Filter>Header Files\system_env</Filter>
+    </ClInclude>
+    <ClInclude Include="includes\system_env\numericconstants_interface.h">
+      <Filter>Header Files\system_env</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\cpp\ast\debugvisitor.cpp">
     <ClCompile Include="src\cpp\system_env\threadmanagement.cpp">
       <Filter>Source Files\system_env</Filter>
     </ClCompile>
+    <ClCompile Include="src\cpp\system_env\numericconstants.cpp">
+      <Filter>Source Files\system_env</Filter>
+    </ClCompile>
+    <ClCompile Include="src\cpp\system_env\numericconstants_interface.cpp">
+      <Filter>Source Files\system_env</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/scilab/modules/ast/includes/system_env/numericconstants.hxx b/scilab/modules/ast/includes/system_env/numericconstants.hxx
new file mode 100644 (file)
index 0000000..752a062
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2015 - Scilab Enterprises - Antoine ELIAS
+*
+*  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
+*
+*/
+
+#ifndef __NUMRICAL_CONSTANTS__
+#define __NUMRICAL_CONSTANTS__
+
+#include "dynlib_ast.h"
+#include "machine.h"
+
+extern "C" double C2F(dlamch) (const char *_val, unsigned long int);
+
+class NumericConstants
+{
+public:
+    EXTERN_AST static double eps;                   //relative machine precision
+    EXTERN_AST static double safe_min;              //safe minimum, such that 1/sfmin does not overflow
+    EXTERN_AST static double base;                  //base of the machine
+    EXTERN_AST static double eps_machine;           //eps*base
+    EXTERN_AST static double num_mantissa_digits;   //number of (base) digits in the mantissa
+    EXTERN_AST static double rounded;               //1.0 when rounding occurs in addition, 0.0 otherwise
+    EXTERN_AST static double exp_min;               //minimum exponent before (gradual) underflow
+    EXTERN_AST static double double_min;                   //underflow threshold - base**(emin-1)
+    EXTERN_AST static double exp_max;               //largest exponent before overflow
+    EXTERN_AST static double double_max;                   //overflow threshold  - (base**emax)*(1-eps)
+
+    EXTERN_AST static void Initialize();
+
+};
+#endif /* !__NUMRICAL_CONSTANTS__ */
diff --git a/scilab/modules/ast/includes/system_env/numericconstants_interface.h b/scilab/modules/ast/includes/system_env/numericconstants_interface.h
new file mode 100644 (file)
index 0000000..74be482
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2015 - Scilab Enterprises - Antoine ELIAS
+*
+*  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 "dynlib_ast.h"
+#include "machine.h"
+
+EXTERN_AST double nc_eps();
+EXTERN_AST double nc_safe_min();
+EXTERN_AST double nc_base();
+EXTERN_AST double nc_eps_machine();
+EXTERN_AST double nc_num_mantissa_digits();
+EXTERN_AST double nc_rounded();
+EXTERN_AST double nc_exp_min();
+EXTERN_AST double nc_double_min();
+EXTERN_AST double nc_exp_max();
+EXTERN_AST double nc_double_max();
+
+//Fortran
+EXTERN_AST double C2F(nc_eps)();
+EXTERN_AST double C2F(nc_safe_min)();
+EXTERN_AST double C2F(nc_base)();
+EXTERN_AST double C2F(nc_eps_machine)();
+EXTERN_AST double C2F(nc_num_mantissa_digits)();
+EXTERN_AST double C2F(nc_rounded)();
+EXTERN_AST double C2F(nc_exp_min)();
+EXTERN_AST double C2F(nc_double_min)();
+EXTERN_AST double C2F(nc_exp_max)();
+EXTERN_AST double C2F(nc_double_max)();
index be6894a..3b98faf 100644 (file)
 #include "doublecomplex.h"
 #include <stdio.h> // debug
 #include <math.h> //sqrt
-
+#include "numericconstants_interface.h"
 #include "invert_matrix.h"
 
-
-extern double C2F(dlamch)(char const* , unsigned long int);
 extern double C2F(dlange)(char const * norm, int const * piRows, int const * piCols
                           , double const *pData, int const * piLDData, double* pdblWork);
 extern double C2F(zlange)(char const * norm, int const * piRows, int const * piCols
@@ -144,7 +142,7 @@ int iInvertMatrix(int iRows, int iCols, double* pData, int complexArg, double *
             C2F(dgecon)("1", &iCols, pData, &iCols, &dblAnorm, pdblRcond, pdblWork, (int*)pWork, &iInfo);
         }
 
-        if (*pdblRcond <= sqrt(C2F(dlamch)("e", 1L)))
+        if (*pdblRcond <= sqrt(nc_eps()))
         {
             ret = -1;
         }
index f6acea5..2df3ff4 100644 (file)
@@ -29,7 +29,7 @@ int iAddScilabPolynomToScilabPolynom(double* _pCoef1R, int _iRank1, double* _pCo
     for (iRank = 0; iRank < iRankMin ; iRank++)
     {
         dblSum = _pCoef1R[iRank] + _pCoef2R[iRank];
-        if (fabs(dblSum) > Max(fabs(_pCoef1R[iRank]), fabs(_pCoef2R[iRank])) * 2 * getRelativeMachinePrecision())
+        if (fabs(dblSum) > Max(fabs(_pCoef1R[iRank]), fabs(_pCoef2R[iRank])) * 2 * nc_eps())
         {
             _pCoefOutR[iRank] = dblSum;
         }
index 1a25944..79be07c 100644 (file)
@@ -296,7 +296,7 @@ int iRightDivisionOfRealMatrix(
 
     cNorm       = '1';
     pDwork      = (double*)malloc(sizeof(double) * iWorkMin);
-    dblEps      = F2C(dlamch)("eps", 1L);
+    dblEps      = nc_eps();
     RCONDthresh = 10 * dblEps;
     dblAnorm    = C2F(dlange)(&cNorm, &_iRows2, &_iCols2, _pdblReal2, &_iRows2, pDwork);
 
@@ -444,7 +444,7 @@ int iRightDivisionOfComplexMatrix(
     pJpvt       = (int*)malloc(sizeof(int) * _iRows2);
     pRwork      = (double*)malloc(sizeof(double) * 2 * _iRows2);
 
-    dblEps      = F2C(dlamch)("eps", 1L);
+    dblEps      = nc_eps();
     RCONDthresh = 10 * dblEps;
     cNorm       = '1';
     dblAnorm    = C2F(zlange)(&cNorm, &_iRows2, &_iCols2, (double*)poVar2, &_iRows2, (double*)poDwork);
@@ -599,7 +599,7 @@ int iLeftDivisionOfRealMatrix(
 
     cNorm       = '1';
     pDwork      = (double*)malloc(sizeof(double) * iWorkMin);
-    dblEps      = C2F(dlamch)("eps", 1L);
+    dblEps      = nc_eps();
     RCONDthresh = 10 * dblEps;
     dblAnorm    = C2F(dlange)(&cNorm, &_iRows1, &_iCols1, _pdblReal1, &_iRows1, pDwork);
 
@@ -722,7 +722,7 @@ int iLeftDivisionOfComplexMatrix(
 
     cNorm       = '1';
     pDwork      = (doublecomplex*)malloc(sizeof(doublecomplex) * iWorkMin);
-    dblEps      = F2C(dlamch)("eps", 1L);
+    dblEps      = nc_eps();
     RCONDthresh = 10 * dblEps;
     dblAnorm    = C2F(zlange)(&cNorm, &_iRows1, &_iCols1, (double*)poVar1, &_iRows1, (double*)pDwork);
 
index ce45a9d..2c23250 100644 (file)
@@ -167,7 +167,7 @@ int iMultiScilabPolynomByScilabPolynom(
         {
             dblMult = _pdblReal1[i1] * _pdblReal2[i2];
             dblAdd = _pdblRealOut[i1 + i2] + dblMult;
-            if (fabs(dblAdd) > 2 * getRelativeMachinePrecision() * Max(fabs(_pdblRealOut[i1 + i2]), fabs(dblMult)))
+            if (fabs(dblAdd) > 2 * nc_eps() * Max(fabs(_pdblRealOut[i1 + i2]), fabs(dblMult)))
             {
                 _pdblRealOut[i1 + i2] = dblAdd;
             }
diff --git a/scilab/modules/ast/src/cpp/system_env/numericconstants.cpp b/scilab/modules/ast/src/cpp/system_env/numericconstants.cpp
new file mode 100644 (file)
index 0000000..601f999
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2015 - Scilab Enterprises - Antoine ELIAS
+*
+*  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 "numericconstants.hxx"
+
+double NumericConstants::eps;
+double NumericConstants::safe_min;
+double NumericConstants::base;
+double NumericConstants::eps_machine;
+double NumericConstants::num_mantissa_digits;
+double NumericConstants::rounded;
+double NumericConstants::exp_min;
+double NumericConstants::double_min;
+double NumericConstants::exp_max;
+double NumericConstants::double_max;
+
+void NumericConstants::Initialize()
+{
+    eps = C2F(dlamch)("E", 1L);
+    safe_min = C2F(dlamch)("S", 1L);
+    base = C2F(dlamch)("B", 1L);
+    eps_machine = C2F(dlamch)("P", 1L);
+    num_mantissa_digits = C2F(dlamch)("N", 1L);
+    rounded = C2F(dlamch)("R", 1L);
+    exp_min = C2F(dlamch)("M", 1L);
+    double_min = C2F(dlamch)("U", 1L);
+    exp_max = C2F(dlamch)("L", 1L);
+    double_max = C2F(dlamch)("O", 1L);
+}
diff --git a/scilab/modules/ast/src/cpp/system_env/numericconstants_interface.cpp b/scilab/modules/ast/src/cpp/system_env/numericconstants_interface.cpp
new file mode 100644 (file)
index 0000000..b1d6d36
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2015 - Scilab Enterprises - Antoine ELIAS
+*
+*  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
+*
+*/
+
+extern "C"
+{
+#include "numericconstants_interface.h"
+}
+
+#include "numericconstants.hxx"
+
+double nc_eps()
+{
+    return NumericConstants::eps;
+}
+
+double nc_safe_min()
+{
+    return NumericConstants::safe_min;
+}
+
+double nc_base()
+{
+    return NumericConstants::base;
+}
+
+double nc_eps_machine()
+{
+    return NumericConstants::eps_machine;
+}
+
+double nc_num_mantissa_digits()
+{
+    return NumericConstants::num_mantissa_digits;
+}
+
+double nc_rounded()
+{
+    return NumericConstants::rounded;
+}
+
+double nc_exp_min()
+{
+    return NumericConstants::exp_min;
+}
+
+double nc_double_min()
+{
+    return NumericConstants::double_min;
+}
+
+double nc_exp_max()
+{
+    return NumericConstants::exp_max;
+}
+
+double nc_double_max()
+{
+    return NumericConstants::double_max;
+}
+
+
+//Fortran
+double C2F(nc_eps)()
+{
+    return NumericConstants::eps;
+}
+
+double C2F(nc_safe_min)()
+{
+    return NumericConstants::safe_min;
+}
+
+double C2F(nc_base)()
+{
+    return NumericConstants::base;
+}
+
+double C2F(nc_eps_machine)()
+{
+    return NumericConstants::eps_machine;
+}
+
+double C2F(nc_num_mantissa_digits)()
+{
+    return NumericConstants::num_mantissa_digits;
+}
+
+double C2F(nc_rounded)()
+{
+    return NumericConstants::rounded;
+}
+
+double C2F(nc_exp_min)()
+{
+    return NumericConstants::exp_min;
+}
+
+double C2F(nc_double_min)()
+{
+    return NumericConstants::double_min;
+}
+
+double C2F(nc_exp_max)()
+{
+    return NumericConstants::exp_max;
+}
+
+double C2F(nc_double_max)()
+{
+    return NumericConstants::double_max;
+}
index 2f2e2a9..e2d12b5 100644 (file)
@@ -18,6 +18,7 @@
 #include "configvariable.hxx"
 #include "scilabWrite.hxx"
 #include "type_traits.hxx"
+#include "numericconstants.hxx"
 
 #ifndef NDEBUG
 #include "inspector.hxx"
@@ -235,7 +236,7 @@ bool ImplicitList::compute()
             }
 
             double dblVal = dblStart; // temp value
-            double dblEps = getRelativeMachinePrecision();
+            double dblEps = NumericConstants::eps;
             double dblPrec = 2 * std::max(fabs(dblStart), fabs(dblEnd)) * dblEps;
 
             while (dblStep * (dblVal - dblEnd) <= 0)
index 196cd73..704761b 100644 (file)
@@ -114,7 +114,7 @@ int sci_contr(char* fname, void* pvApiCtx)
         }
     }
 
-    theTOL = (double) C2F(dlamch)("e", 1L);
+    theTOL = nc_eps();
     // Retrieve a matrix of double at position 1.
     sciErr = getMatrixOfDouble(pvApiCtx, piAddrptrA, &mA, &nA, &ptrA);
     if (sciErr.iErr)
index 688ce18..779f0dc 100644 (file)
@@ -13,9 +13,9 @@
 #include "api_scilab.h"
 #include "Scierror.h"
 #include "localization.h"
+#include "numericconstants_interface.h"
 
 extern int C2F(sb10dd)();
-extern double C2F(dlamch)();
 
 // [Ak,Bk,Ck,Dk,RCOND]=dhinf(A,B,C,D,ncon,nmeas,gamma)
 int sci_dhinf(char *fname, void* pvApiCtx)
@@ -305,7 +305,7 @@ int sci_dhinf(char *fname, void* pvApiCtx)
     }
 
     GAMMA = *lGAMMA;
-    EPS = C2F(dlamch)("e", 1L);
+    EPS = nc_eps();
     TOL = sqrt(EPS);
 
     sciErr = allocMatrixOfDouble(pvApiCtx, 8, N, N, &lAK);
index c9dcd2f..aa2cdcf 100644 (file)
@@ -13,9 +13,9 @@
 #include "api_scilab.h"
 #include "Scierror.h"
 #include "localization.h"
+#include "numericconstants_interface.h"
 
 extern int C2F(sb10fd)();
-extern double C2F(dlamch)();
 
 // [Ak,Bk,Ck,Dk,RCOND]=hinf(A,B,C,D,ncon,nmeas,gamma)
 int sci_hinf(char *fname, void* pvApiCtx)
@@ -303,7 +303,7 @@ int sci_hinf(char *fname, void* pvApiCtx)
     }
 
     GAMMA = *lGAMMA;
-    EPS = C2F(dlamch)("e", 1L);
+    EPS = nc_eps();
     TOL = sqrt(EPS);
 
     sciErr = allocMatrixOfDouble(pvApiCtx, 8, N, N, &lAK);
index 46a955d..a790f48 100644 (file)
@@ -14,6 +14,7 @@
 #include "function.hxx"
 #include "double.hxx"
 #include "polynom.hxx"
+#include "numericconstants.hxx"
 
 extern "C"
 {
@@ -129,7 +130,7 @@ types::Function::ReturnValue freqRational(types::typed_list &in, int _iRetCount,
         {
             types::Polynom* pPolyDen = in[1]->getAs<types::Polynom>();
 
-            double dblEps = getRelativeMachinePrecision();
+            double dblEps = NumericConstants::eps;
 
             if (pPolyDen->isComplex())
             {
@@ -206,7 +207,7 @@ types::Function::ReturnValue freqRational(types::typed_list &in, int _iRetCount,
         {
             types::Polynom* pPolyNum = in[0]->getAs<types::Polynom>();
 
-            double dblEps = getRelativeMachinePrecision();
+            double dblEps = NumericConstants::eps;
             if (pPolyNum->isComplex())
             {
                 bool cplx = false;
index 18186eb..82b2f85 100644 (file)
@@ -34,8 +34,7 @@ types::Function::ReturnValue sci_ppol(types::typed_list &in, int _iRetCount, typ
     types::Double* pDblB = NULL;
     types::Double* pDblP = NULL;
 
-    char cP       = 'p';
-    double dblEps = 0.1 * sqrt(C2F(dlamch)(&cP, 1L));
+    double dblEps = 0.1 * sqrt(nc_eps_machine());
 
     int iOne   = 1;
     int iSizeP = 0;
index 10a04dd..26ef39d 100644 (file)
@@ -40,8 +40,7 @@ types::Function::ReturnValue sci_residu(types::typed_list &in, int _iRetCount, t
     types::Polynom* pPoly[3] = {NULL, NULL, NULL};
     types::Double* pDblOut   = NULL;
 
-    char cP         = 'p';
-    double dblEps   = C2F(dlamch)(&cP, 1L);
+    double dblEps   = nc_eps_machine();
     double dZero    = 0;
     int iOne        = 1;
     int iSize       = 0;
index b31f0bb..0fbc0ef 100644 (file)
@@ -13,6 +13,7 @@
 #include "cacsd_gw.hxx"
 #include "function.hxx"
 #include "double.hxx"
+#include "numericconstants.hxx"
 
 extern "C"
 {
@@ -31,8 +32,8 @@ types::Function::ReturnValue sci_tzer(types::typed_list &in, int _iRetCount, typ
     int iRows[4] = {0, 0, 0, 0};
     int iCols[4] = {0, 0, 0, 0};
     double* pdblIn[4] = {NULL, NULL, NULL, NULL};
-    char cP = 'p';
-    double dblEps = C2F(dlamch)(&cP, 1L);
+
+    double dblEps = NumericConstants::eps_machine;
     int iOne = 1;
 
     if (in.size() != 4)
index ed8d35b..85788a4 100644 (file)
@@ -30,6 +30,7 @@
 #include "visitor_common.hxx"
 #include "operations.hxx"
 #include "threadmanagement.hxx"
+#include "numericconstants.hxx"
 
 #include "expandPathVariable.h"
 
@@ -167,7 +168,7 @@ int StartScilabEngine(ScilabEngineInfo* _pSEI)
 #endif
 
     ThreadManagement::initialize();
-
+    NumericConstants::Initialize();
     checkForLinkerErrors();
 
 #ifdef _MSC_VER
@@ -994,7 +995,7 @@ static void Add_pi(void)
 
 static void Add_eps(void)
 {
-    Add_Double_Constant(L"%eps", C2F(dlamch) ("p", 1L), 0, false);
+    Add_Double_Constant(L"%eps", NumericConstants::eps_machine, 0, false);
 }
 
 static void Add_e(void)
index a242c41..2de35c1 100644 (file)
@@ -3,7 +3,7 @@
 #include "machine.h"
 #include "core_math.h"
 #include "Ex-daskr.h"
-#include "elem_common.h" // dlamch
+#include "numericconstants_interface.h"
 
 void pjac1( resfunc res, int *ires, int *nequations, double *tOld, double *actual, double *actualP,
             double *rewt, double *savr, double *wk, double *h, double *cj, double *wp, int *iwp,
@@ -21,8 +21,7 @@ void pjac1( resfunc res, int *ires, int *nequations, double *tOld, double *actua
     double * e = NULL;
 
     int neq = *nequations;
-    char cP[1] = "P";
-    double SQuround = sqrt(C2F(dlamch)(cP, 1L));
+    double SQuround = sqrt(nc_eps_machine());
 
     tx = *tOld;
 
index 1f37cf5..bcf7c35 100644 (file)
 #include "machine.h"
 
 #include "doublecomplex.h"
+#include "numericconstants_interface.h"
 
 #ifdef __cplusplus
-#define getRelativeMachinePrecision()          C2F(dlamch)(const_cast<char*>("e"), 1L)
-#define isRealZero(x)                                          (fabs(static_cast<double>(x)) <= getRelativeMachinePrecision())
-#define ZeroIsZero(x)                                          (fabs(static_cast<double>(x)) <= getRelativeMachinePrecision() ? 0 : static_cast<double>(x))
+#define isRealZero(x)                                          (fabs(static_cast<double>(x)) <= nc_eps())
+#define ZeroIsZero(x)                                          (fabs(static_cast<double>(x)) <= nc_eps() ? 0 : static_cast<double>(x))
 #else
-#define getRelativeMachinePrecision()          C2F(dlamch)((char*)"e", 1L)
-#define isZero(x)                                                      (fabs((double)x) <= getRelativeMachinePrecision())
-#define ZeroIsZero(x)                                          (fabs((double)x) <= getRelativeMachinePrecision() ? 0 : (double)x)
+#define isZero(x)                                                      (fabs((double)x) <= nc_eps())
+#define ZeroIsZero(x)                                          (fabs((double)x) <= nc_eps() ? 0 : (double)x)
 #endif
 
-#define getUnderflowThreshold()                                        C2F(dlamch)((char*)"u", 1L)
-#define getOverflowThreshold()                                 C2F(dlamch)((char*)"o", 1L)
-#define isEqual(x,y)                                                                           fabs((double)x - (double)y) <= getRelativeMachinePrecision()
+#define getUnderflowThreshold()                                nc_double_min()
+#define getOverflowThreshold()                         nc_double_max()
+#define isEqual(x,y)                                           fabs((double)x - (double)y) <= nc_eps()
 
 extern double C2F(dlamch) (const char *_pszCommand, unsigned long int);
 extern double C2F(logp1) (double *_pdblVal);
index db7ac5f..0710ef5 100644 (file)
@@ -54,36 +54,36 @@ int sci_number_properties(char *fname, void* pvApiCtx)
 
     if (strcmp(pstData[0], "eps") == 0)
     {
-        dblRet = F2C(dlamch)("e", 1L);
+        dblRet = nc_eps();
     }
     else if (strcmp(pstData[0], "huge") == 0)
     {
-        dblRet = F2C(dlamch)("oe", 1L);
+        dblRet = nc_double_max();
     }
     else if (strcmp(pstData[0], "tiny") == 0)
     {
-        dblRet = F2C(dlamch)("u", 1L);
+        dblRet = nc_double_min();
     }
     else if (strcmp(pstData[0], "radix") == 0)
     {
-        dblRet = F2C(dlamch)("b", 1L);
+        dblRet = nc_base();
     }
     else if (strcmp(pstData[0], "digits") == 0)
     {
-        dblRet = F2C(dlamch)("n", 1L);
+        dblRet = nc_num_mantissa_digits();
     }
     else if (strcmp(pstData[0], "minexp") == 0)
     {
-        dblRet = F2C(dlamch)("m", 1L);
+        dblRet = nc_exp_min();
     }
     else if (strcmp(pstData[0], "maxexp") == 0)
     {
-        dblRet = F2C(dlamch)("l", 1L);
+        dblRet = nc_exp_max();
     }
     else if (strcmp(pstData[0], "denorm") == 0)
     {
         bBoolFlag = 1;
-        if (F2C(dlamch)("u", 1L) / F2C(dlamch)("b", 1L) > 0)
+        if (nc_double_min() / nc_base() > 0)
         {
             bRet       = 1;
         }
@@ -94,13 +94,13 @@ int sci_number_properties(char *fname, void* pvApiCtx)
     }
     else if (strcmp(pstData[0], "tiniest") == 0)
     {
-        double dblRadix        = F2C(dlamch)("b", 1L);
-        dblRet = F2C(dlamch)("u", 1L);
+        double dblRadix = nc_base();
+        dblRet = nc_double_min();
 
         if (dblRet     / dblRadix != 0)
         {
             //denormalised number are used
-            int iDigits = (int)F2C(dlamch)("n", 1L);
+            int iDigits = (int)nc_num_mantissa_digits();
             for (i = 1 ; i < iDigits ; i++)
             {
                 dblRet /= dblRadix;
index ea24196..708edfb 100644 (file)
@@ -11,6 +11,7 @@
 *
 */
 //for Visual Leak Detector in debug compilation mode
+//#define DEBUG_VLD
 #if defined(DEBUG_VLD) && defined(_DEBUG)
 #include <vld.h>
 #endif
index 55fdd03..a4ad467 100644 (file)
@@ -310,7 +310,8 @@ int dbdiaga(int _iLeadDim, int _iSize, double *_pdblVal, double _dblEps,
     {
         dblEps = 1;
     }
-    dblEps = F2C(dlamch)("p", 1L) * dblEps;
+
+    dblEps = nc_eps_machine() * dblEps;
 
     //convert a to upper hessenberg form.
     dbalancs(_iLeadDim, _iSize, _pdblVal, &iLow, &iHigh, _pdblScale);
@@ -1293,7 +1294,7 @@ int dhqror2s(int _iLead, int _iSize, int _iLow, int _iHigh,
     int iHigh          = _iHigh - 1;
 
     double dblNorm     = 0;
-    double dblEps      = F2C(dlamch)("p", 1L);
+    double dblEps = nc_eps_machine();
 
     double dblP                = 0;
     double dblQ                = 0;
index 7355e86..a8ef2fa 100644 (file)
@@ -10,6 +10,7 @@
  *
  */
 #include "elem_common.h"
+#include "numericconstants_interface.h"
 
 /*tan*/
 double dtans(double _dblVal)
@@ -87,7 +88,7 @@ TRANSLATE TO C
 void ztans(double _dblRealIn, double _dblImgIn, double* _pdblRealOut, double* _pdblImgOut)
 {
     double dblTemp = 0;
-    double dblLim = 1 + dlogs(2.0 / dsqrts(getRelativeMachinePrecision()));
+    double dblLim = 1 + dlogs(2.0 / dsqrts(nc_eps()));
 
     dblTemp                    = pow(dcoss(_dblRealIn), 2) + pow(dsinhs(_dblImgIn), 2);
     *_pdblRealOut      = 0.5 * dsins(2 * _dblRealIn) / dblTemp;
index b81cdb5..d9e0ce7 100644 (file)
@@ -43,7 +43,8 @@
 #include "sciprint.h"
 #include "localization.h"
 #include "Scierror.h"
-#include <machine.h>
+#include "machine.h"
+#include "numericconstants_interface.h"
 
 #include "getGraphicObjectProperty.h"
 #include "graphicObjectProperties.h"
@@ -55,8 +56,6 @@
 
 /* end here */
 
-extern double C2F(dlamch)  (char *CMACH, unsigned long int);
-
 static void FormatPrec (char *fmt, int *desres, double xmin, double xmax,
                         double xpas);
 static void FormatPrec1 (char *fmt, int *desres, double *xx, int nx);
@@ -562,7 +561,7 @@ static void decompSup(double x, int *xk, int *xa, int b)
             static int first = 0;
             if (first == 0)
             {
-                epsilon = 10.0 * F2C(dlamch)("e", 1L);
+                epsilon = 10.0 * nc_eps();
                 first++;
             }
             /* if x is very near (k+1)10^a (epsilon machine)
@@ -612,7 +611,7 @@ static void decompInf(double x, int *xk, int *xa, int b)
             static int first = 0;
             if (first == 0)
             {
-                epsilon = 10.0 * F2C(dlamch)("e", 1L);
+                epsilon = 10.0 * nc_eps();
                 first++;
             }
             *xa = (int) floor(log10(x)) - b + 1;
index c9886ea..71f3cd2 100644 (file)
@@ -255,6 +255,9 @@ lib /DEF:"$(ProjectDir)linear_algebra_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:
     <ProjectReference Include="..\..\..\api_scilab\api_scilab.vcxproj">
       <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\ast\ast.vcxproj">
+      <Project>{0d3fa25b-8116-44ec-a45e-260789daa3d9}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\dynamic_link\src\c\dynamic_link.vcxproj">
       <Project>{eab6c580-22b3-4359-ba1d-dd7499a96163}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index d2e00ce..9423442 100644 (file)
@@ -15,7 +15,7 @@
 #include "machine.h"
 #include "core_math.h"
 #include "sci_malloc.h"
-
+#include "numericconstants_interface.h"
 #include "lsq.h"
 
 
@@ -36,9 +36,6 @@ extern void C2F(dlacpy)(char const * uplo /* "U"pper, "L"ower, or full*/, int co
 extern void C2F(zlacpy)(char const * uplo /* "U"pper, "L"ower, or full*/, int const * piRows, int const * piCols
                         , doublecomplex const* pdblSource, int const * piLDSource, doublecomplex* pdblDest, int const* piLDDest);
 
-/* query for epsilon */
-extern double C2F(dlamch)(char const query[1], long );
-
 /*
  * [try to] allocate workspace for [d|z]gelsy Lapack routines. First try to allocate optimal worksize (after querying Lapack for this size). If that fails
  * try to allocate minimal worksize (as per Lapack routines specifications). If that also fails, return NULL and set *allocated to 0.
@@ -109,7 +106,7 @@ int iLsqM(double* pData1, int iRows, int iCols, double* pData2, int iNRhs, int c
     int* pPivot = NULL;
     int worksize = 0 ;
     int unusedRank;
-    double const treshold = pTreshold ? *pTreshold : sqrt(C2F(dlamch)("e", 1L)) ;
+    double const treshold = pTreshold ? *pTreshold : sqrt(nc_eps());
 
     if ( (pRwork = (double*)( complexArgs ? (double*)MALLOC(2 * iCols * sizeof(double)) : allocDgelsyWorkspace(iRows, iCols, iNRhs, &worksize)))
             && (pXb = (double*)MALLOC(Max(iRows, iCols) * iNRhs * (complexArgs ? sizeof(doublecomplex) : sizeof(double))))
index ab6fbe5..df353ba 100644 (file)
@@ -287,8 +287,7 @@ int iQr(double* pData, int iRows, int iCols,  int iRowsToCompute, double dblTol
             double tt = complexArg ? C2F(pythag)(pdblR, pdblR + 1) : Abs(*pdblR) ;
             if ( dblTol < 0) /* /!\ original Frotran code does strict fp comparison with -1.0 */
             {
-                // C2F(dlamch("p")) -> epsilon  * base
-                dblTol = Max(iRows, iCols) * C2F(dlamch)("p", 1L) * tt;
+                dblTol = Max(iRows, iCols) * nc_eps_machine() * tt;
             }
             {
                 int j, k = 0;
index 38859c8..9120a5c 100644 (file)
@@ -17,6 +17,7 @@
 #include "sci_malloc.h"
 #include "core_math.h"
 #include "svd.h"
+#include "numericconstants_interface.h"
 
 /*
  * Lapack functions performing the real work
@@ -33,8 +34,6 @@ extern void C2F(dgesvd)(char const jobU[1]/* 'A'|'S'|'O'|'N'*/, char const jobVT
  */
 /* sorting (used to correct a Lapack bug */
 extern void C2F(dlasrt)(char const id[1]/* 'I'ncreasing|'D'ecreasing order */, int const* length, double* array, int* info);
-/* querying for epsilon, used for default treshold value */
-extern double C2F(dlamch)(char const query[1], long );
 
 /*
  * functions used to allocate workspace for Lapack functions
@@ -138,7 +137,7 @@ int iSvdM(double* pData, int iRows, int iCols, int complexArg, int economy, doub
                           || (pRWork = (double*) MALLOC(5 * Min(iRows, iCols) * sizeof(double))))
                       && (pVT = (pU
                                  ? (double*)MALLOC(colsToCompute * iCols * (complexArg ? sizeof(doublecomplex) : sizeof(double)))
-                                     : pData)))))
+                                 : pData)))))
     {
         ret = complexArg
               ? iZgesvd(job,  (doublecomplex*)pData, iRows, iCols, colsToCompute, pSV, (doublecomplex*) pU, (doublecomplex*)pVT
@@ -158,7 +157,7 @@ int iSvdM(double* pData, int iRows, int iCols, int complexArg, int economy, doub
                 if (pRk) /* compute rank */
                 {
                     int i, rk;
-                    tol = (tol == 0.) ? (Max(iRows, iCols) * C2F(dlamch)("e", 1L) * pSV[0]) : tol; /* original Fortran code does the strict fp compare */
+                    tol = (tol == 0.) ? (Max(iRows, iCols) * nc_eps() * pSV[0]) : tol; /* original Fortran code does the strict fp compare */
                     rk = -1;
                     for (i = 0; i != Min(iRows, iCols); ++i)
                     {
index 623499a..0a4a51c 100644 (file)
@@ -93,7 +93,7 @@ int schur_sb02ow(double* _real, double* _img, double* _beta) // continu
 {
     return  (*_real < 0 && *_beta > 0) ||
             ((*_real > 0 && *_beta < 0) &&
-             (fabs(*_beta) > fabs(*_real) * C2F(dlamch)((char*)"p", 1L))) ? 1 : 0;
+             (fabs(*_beta) > fabs(*_real) * nc_eps_machine())) ? 1 : 0;
 }
 int schur_dgges(double* _real, double* _img, double* _beta)
 {
index b3c7ff0..b5a9810 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types;../ast/includes/system_env</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;MPI_EXPORTS;_CRT_SECURE_NO_DEPRECATE;OMPI_IMPORTS;OPAL_IMPORTS;ORTE_IMPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types;../ast/includes/system_env</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;MPI_EXPORTS;_CRT_SECURE_NO_DEPRECATE;OMPI_IMPORTS;OPAL_IMPORTS;ORTE_IMPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types;../ast/includes/system_env</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;MPI_EXPORTS;_CRT_SECURE_NO_DEPRECATE;OMPI_IMPORTS;OPAL_IMPORTS;ORTE_IMPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;../../libs/mpi/include;../../libs/intl;../api_scilab/includes;../core/includes;../output_stream/includes;../localization/includes;../elementary_functions/includes;../ast/includes/operations;../ast/includes/ast;../ast/includes/types;../ast/includes/system_env</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;MPI_EXPORTS;_CRT_SECURE_NO_DEPRECATE;OMPI_IMPORTS;OPAL_IMPORTS;ORTE_IMPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
index d702d86..dfad604 100644 (file)
@@ -15,9 +15,9 @@
 #include "api_scilab.h"
 #include "Scierror.h"
 #include "localization.h"
+#include "numericconstants_interface.h"
 /*--------------------------------------------------------------------------*/
 /* fortran subroutines */
-extern double C2F(dlamch)  (char *CMACH, unsigned long int);
 extern int C2F(ql0001)(int *m, int *me, int *mmax, int *n, int *nmax, int *mnn,
                        double *c, double *d, double *a, double *b, double *xl,
                        double *xu, double *x, double *u, int *iout, int *ifail,
@@ -67,7 +67,7 @@ int sci_qld(char *fname, void* pvApiCtx)
 
     /* RhsVar: qld(Q,p,C,b,lb,ub,me,eps) */
     /*             1,2,3,4,5 ,6 ,7, 8  */
-    eps1 = C2F(dlamch)("e", 1L);
+    eps1 = nc_eps();
     next = nbInputArgument(pvApiCtx) + 1;
     /*   Variable 1 (Q)   */
     //get variable address
@@ -192,7 +192,7 @@ int sci_qld(char *fname, void* pvApiCtx)
         return 1;
     }
 
-    if (nbis*unbis == 0)
+    if (nbis * unbis == 0)
     {
         sciErr = allocMatrixOfDouble(pvApiCtx, next, n, un, &lb);
         if (sciErr.iErr)
@@ -204,7 +204,7 @@ int sci_qld(char *fname, void* pvApiCtx)
 
         for (k = 0; k < n; k++)
         {
-            (lb)[k] = -C2F(dlamch)("o", 1L);
+            (lb)[k] = -nc_double_max();
         }
         next = next + 1;
     }
@@ -232,7 +232,7 @@ int sci_qld(char *fname, void* pvApiCtx)
         return 1;
     }
 
-    if (nbis*unbis == 0)
+    if (nbis * unbis == 0)
     {
         sciErr = allocMatrixOfDouble(pvApiCtx, next, n, un, &ub);
         if (sciErr.iErr)
@@ -244,7 +244,7 @@ int sci_qld(char *fname, void* pvApiCtx)
 
         for (k = 0; k < n; k++)
         {
-            (ub)[k] = C2F(dlamch)("o", 1L);
+            (ub)[k] = nc_double_max();
         }
         next = next + 1;
     }
index 99eb460..c776f35 100644 (file)
@@ -17,6 +17,7 @@
 #include "polynom.hxx"
 #include "list.hxx"
 #include "optimizationfunctions.hxx"
+#include "numericconstants.hxx"
 #include <limits>
 
 extern "C"
@@ -96,7 +97,7 @@ types::Function::ReturnValue sci_optim(types::typed_list &in, types::optional_li
     // stop arguments "ar"
     int iNap        = 100;
     int iItMax      = 100;
-    double dEpsg    = C2F(dlamch)((char*)"p", 1L); // p : eps*base
+    double dEpsg    = NumericConstants::eps_machine; // p : eps*base
     double dTol     = dEpsg;
     double dEpsf    = 0;
 
@@ -1121,16 +1122,16 @@ types::Function::ReturnValue sci_optim(types::typed_list &in, types::optional_li
 
         ret = types::Function::OK;
     }
-    catch (const ast::ScilabException& /* e */)
-    {
-        // free memory, then return error
-    }
     catch (const ast::InternalError& e)
     {
         char* pstrMsg = wide_string_to_UTF8(e.GetErrorMessage().c_str());
         Scierror(999, pstrMsg);
         FREE(pstrMsg);
     }
+    catch (const ast::ScilabException& /* e */)
+    {
+        // free memory, then return error
+    }
 
     /*** free memory ***/
     if (opFunctionsManager)
index e7bcba1..f43c9f4 100644 (file)
@@ -15,6 +15,7 @@
 #include "double.hxx"
 #include "string.hxx"
 #include "tlist.hxx"
+#include "numericconstants.hxx"
 
 extern "C"
 {
@@ -56,7 +57,7 @@ types::Function::ReturnValue sci_readmps(types::typed_list &in, int _iRetCount,
     wchar_t* wcsFileName = NULL;
     char* strErrorBuf = new char[bsiz];
 
-    double big = C2F(dlamch)((char*)"o", 1L);
+    double big = NumericConstants::double_max;
 
     if (in.size() < 2 || in.size() > 3)
     {
index 1789402..e49c415 100644 (file)
@@ -18,6 +18,7 @@
 #include "sciprint.h"
 #include "localization.h"
 #include "configvariable_interface.h"
+#include "numericconstants_interface.h"
 /*--------------------------------------------------------------------------*/
 /* BLAS 1 */
 extern double F2C(dnrm2)( );
@@ -39,7 +40,6 @@ extern void F2C(dspgst)( );
 extern void F2C(dspev)( );
 extern void F2C(dspgv)( );
 extern void F2C(dtrcon)( );
-extern double F2C(dlamch)( );
 /*--------------------------------------------------------------------------*/
 /*
  * if itype = 1, computes C = B*A*B', otherwise, computes C = B'*A*B
@@ -170,8 +170,8 @@ int C2F(spf)(
     int *info            /* status on termination */
 )
 {
-    return(sp(*m, *L, F, blck_szs, c, x, Z, ul, *nu, *abstol, *reltol, *tv, iters, work,
-              *lwork, iwork, info));
+    return (sp(*m, *L, F, blck_szs, c, x, Z, ul, *nu, *abstol, *reltol, *tv, iters, work,
+               *lwork, iwork, info));
 }
 /*--------------------------------------------------------------------------*/
 int sp(
@@ -778,7 +778,7 @@ int sp(
          * check corners of feasible rectangle
          */
 
-        dbl_epsilon = F2C(dlamch)("e");
+        dbl_epsilon = nc_eps();
         if (nrmx > SIGTOL * nrmmax)
             if (ZdX < 0.0)
             {
index 1f113ed..9fdb53c 100644 (file)
@@ -29,8 +29,6 @@ extern "C"
     extern int C2F(dprxc)(int*, double*, double*);
     extern int C2F(wprxc)(int*, double*, double*, double*, double*);
     extern double C2F(dasum)(int*, double*, int*);
-    extern double C2F(dlamch) (const char*, unsigned long int);
-
 }
 /*--------------------------------------------------------------------------*/
 types::Function::ReturnValue sci_poly(types::typed_list &in, int _iRetCount, types::typed_list &out)
@@ -136,7 +134,7 @@ types::Function::ReturnValue sci_poly(types::typed_list &in, int _iRetCount, typ
         double* pdblCoefReal = pPolyOut->get(0)->get();
         if (pDblIn->isComplex())
         {
-            double dblEps = (double)C2F(dlamch)("p", 1L);
+            double dblEps = nc_eps_machine();
             pPolyOut->setComplex(true);
             double* pdblInImg   = pDblIn->getImg();
             double* pdblCoefImg = pPolyOut->get(0)->getImg();
index 1644e48..5876c29 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/system_env;../../../../ast/includes/ast;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -116,7 +116,7 @@ lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/ast;../../../../ast/includes/system_env;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -150,7 +150,7 @@ lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/system_env;../../../../ast/includes/ast;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -191,7 +191,7 @@ lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/c;../../../src/cpp;../../../src/jni;../../../../../libs/intl;../../../../../libs/hdf5/include;../../../../output_stream/includes;../../../../localization/includes;../../../../graphics/includes;../../../../scicos/includes;../../../../core/includes;../../../../renderer/includes;../../../../elementary_functions/includes;../../../../string/includes;../../../../windows_tools/includes;../../../../jvm/includes;../../../../fileio/includes;../../../../commons/src/jni;../../../../graphic_objects/includes;../../../../api_scilab/includes;../../../../ast/includes/ast;../../../../ast/includes/system_env;../../../../ast/includes/operations;../../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -580,6 +580,9 @@ lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS
     <ProjectReference Include="..\..\..\..\api_scilab\api_scilab.vcxproj">
       <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\..\ast\ast.vcxproj">
+      <Project>{0d3fa25b-8116-44ec-a45e-260789daa3d9}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\..\commons\src\c\commons.vcxproj">
       <Project>{eca09a1e-6d12-4a47-92e1-a671c181df77}</Project>
     </ProjectReference>
index c032c06..3550ea0 100644 (file)
 #include "scicos_malloc.h"
 #include "scicos_free.h"
 #include "dynlib_scicos_blocks.h"
+#include "numericconstants_interface.h"
 /*--------------------------------------------------------------------------*/
 extern int C2F(dgetrf)(int *m, int *n, double *a, int *
                        lda, int *ipiv, int *info);
-extern double C2F(dlamch)(char *cmach);
 extern double C2F(dlange)(char *norm, int *m, int *n, double *a, int
                           *lda, double *work);
 extern int C2F(dlacpy)(char *uplo, int *m, int *n, double *
@@ -191,7 +191,7 @@ SCICOS_BLOCKS_IMPEXP void mat_bksl(scicos_block *block, int flag)
     else
     {
         ptr = *work;
-        EPS = C2F(dlamch)("e");
+        EPS = nc_eps();
         ANORM = C2F(dlange)("1", &mu, &nu1, u1, &mu, ptr->dwork);
         C2F(dlacpy)("F", &mu, &nu1, u1, &mu, ptr->LA, &mu);
         if (mu == nu1)
index 5671929..4635401 100644 (file)
 #include "scicos_malloc.h"
 #include "scicos_free.h"
 #include "dynlib_scicos_blocks.h"
+#include "numericconstants_interface.h"
 /*--------------------------------------------------------------------------*/
 extern int C2F(dgetrf)(int *m, int *n, double *a, int *
                        lda, int *ipiv, int *info);
-extern double C2F(dlamch)(char *cmach);
 extern double C2F(dlange)(char *norm, int *m, int *n, double *a, int
                           *lda, double *work);
 extern int C2F(dlacpy)(char *uplo, int *m, int *n, double *
@@ -189,7 +189,7 @@ SCICOS_BLOCKS_IMPEXP void mat_div(scicos_block *block, int flag)
     else
     {
         ptr = *work;
-        EPS = C2F(dlamch)("e");
+        EPS = nc_eps();
         ANORM = C2F(dlange)("l", &mu1, &nu, u1, &mu1, ptr->dwork);
         for (j = 0; j < mu1; j++)
         {
index 9f807c2..39bf660 100644 (file)
 #include "scicos_free.h"
 #include "scicos_block4.h"
 #include "dynlib_scicos_blocks.h"
+#include "numericconstants_interface.h"
 /*--------------------------------------------------------------------------*/
 extern int C2F(zlacpy)(char *uplo, int *m, int *n,
                        double *a, int *lda, double *b, int *ldb);
 extern int C2F(zgetrf)(int *m, int *n, double *a,
                        int *lda, int *ipiv, int *info);
-extern double C2F(dlamch)(char *cmach);
 extern double C2F(zlange)(char *norm, int *m, int *n, double *a,
                           int *lda, double *work);
 extern int C2F(zgecon)(char *norm, int *n, double *a,
@@ -222,7 +222,7 @@ SCICOS_BLOCKS_IMPEXP void matz_bksl(scicos_block *block, int flag)
             ptr->IN2[2 * i] = u2r[i];
             ptr->IN2[2 * i + 1] = u2i[i];
         }
-        EPS = C2F(dlamch)("e");
+        EPS = nc_eps();
         ANORM = C2F(zlange)("1", &mu, &nu1, ptr->IN1, &mu, ptr->dwork);
         if (mu == nu1)
         {
index 131bace..96971ef 100644 (file)
 #include "scicos_free.h"
 #include "scicos_block4.h"
 #include "dynlib_scicos_blocks.h"
+#include "numericconstants_interface.h"
 /*--------------------------------------------------------------------------*/
 extern int C2F(zlacpy)(char *uplo, int *m, int *n,
                        double *a, int *lda, double *b, int *ldb);
 extern int C2F(zgetrf)(int *m, int *n, double *a,
                        int *lda, int *ipiv, int *info);
 extern int C2F(mtran)(double* a, int* na, double* b, int* nb, int* m, int* n);
-extern double C2F(dlamch)(char *cmach);
 extern double C2F(zlange)(char *norm, int *m, int *n, double *a,
                           int *lda, double *work);
 extern int C2F(zgecon)(char *norm, int *n, double *a,
@@ -340,7 +340,7 @@ SCICOS_BLOCKS_IMPEXP void matz_div(scicos_block *block, int flag)
             ptr->IN2[2 * i] = ptr->urT2[i];
             ptr->IN2[2 * i + 1] = -ptr->uiT2[i];
         }
-        EPS = C2F(dlamch)("e");
+        EPS = nc_eps();
         ANORM = C2F(zlange)("1", &nu, &mu1, ptr->IN1, &nu, ptr->dwork);
         if (mu1 == nu)
         {
index 64cefee..e07b63b 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/system_env;../../../ast/includes/ast;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -115,7 +115,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/system_env;../../../ast/includes/ast;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -148,7 +148,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/system_env;../../../ast/includes/ast;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -188,7 +188,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../src/jni;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../localization/includes;../../../graphics/includes;../../../scicos/includes;../../../core/includes;../../../renderer/includes;../../../elementary_functions/includes;../../../string/includes;../../../windows_tools/includes;../../../jvm/includes;../../../fileio/includes;../../../commons/src/jni;../../../graphic_objects/includes;../../../api_scilab/includes;../../../ast/includes/system_env;../../../ast/includes/ast;../../../ast/includes/operations;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_BLOCKS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -579,6 +579,9 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ProjectReference Include="..\..\..\api_scilab\api_scilab.vcxproj">
       <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\ast\ast.vcxproj">
+      <Project>{0d3fa25b-8116-44ec-a45e-260789daa3d9}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\commons\src\c\commons.vcxproj">
       <Project>{eca09a1e-6d12-4a47-92e1-a671c181df77}</Project>
     </ProjectReference>
index 654b294..7db6523 100644 (file)
@@ -56,7 +56,7 @@ types::Function::ReturnValue sci_lufact(types::typed_list &in, int _iRetCount, t
         return types::Function::Error;
     }
 
-    abstol = C2F(dlamch) ("p", 1L);
+    abstol = nc_eps_machine();
 
     //call format
     if (in.size() == 2)
index 1189825..1bd8060 100644 (file)
@@ -94,7 +94,7 @@ types::Function::ReturnValue sci_lusolve(types::typed_list &in, int _iRetCount,
         pSpIn->getNbItemByRow(itemsRow);
 
         fmatindex = new int[1];
-        abstol = C2F(dlamch) ("p", 1L);
+        abstol = nc_eps_machine();
         C2F(lufact1)(dbl, itemsRow, colPos, &m1, &nonZeros, fmatindex, &abstol, &reltol, &nrank, &ierr);
         fact = true;
 
index 62dd7dd..f884869 100644 (file)
@@ -16,6 +16,7 @@
 #include "machine.h"
 #include "core_math.h"
 #include "returnanan.h"
+#include "numericconstants_interface.h"
 /*--------------------------------------------------------------------------*/
 /* fortran subroutines */
 extern int C2F(dset)();
@@ -23,7 +24,6 @@ extern int C2F(dscal)();
 extern int C2F(wscal)();
 extern int C2F(zbesh)();
 extern int C2F(dcopy)();
-extern double C2F(dlamch)();
 /*--------------------------------------------------------------------------*/
 static int zbeshg(double *x1r, double *x1i, double *alpha,
                   int *kode, int *k, int *n, double *yr,
@@ -37,7 +37,7 @@ int zbeshv(double *xr, double *xi, int *nx,
            double *alpha, int *na, int *kode, int *k, double
            *yr, double *yi, double *wr, double *wi, int *ierr)
 {
-    double eps = C2F(dlamch)("p", strlen("p"));
+    double eps = nc_eps_machine();
     int iOne = 1;
     int i = 0, j = 0, nz = 0;