Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10848

Option --fp_single_precision_constant errors on unsuffixed double precision float constants that are out of range of single precision float

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-10101
    • C2000_22.6.0.LTS
    • C2000_22.6.1.LTS*
    • default
    • Hide
      If using --fp_single_precision_constant generates below error:
      "/db/sds11/build/release/ank/rel22_6_0_LTS/build/product/linux/include/stlport/s__limits.h", line 516: error: floating constant is out of range

      Then update this file with below changes
         C:\compilers\ti-cgt-c2000_22.6.0.LTS\include\float.h

      Replace below:

      #define DBL_MIN 2.2250738585072014E-308 /* MIN NORMALIZED POS VALUE */
      #define DBL_MAX 1.7976931348623157E+308 /* MAX POSITIVE VALUE */

      With these updates to explicitly set suffix:

      #define DBL_MIN ((double)(2.2250738585072014E-308L)) /* MIN NORMALIZED POS VALUE */
      #define DBL_MAX ((double)(1.7976931348623157E+308L)) /* MAX POSITIVE VALUE */
      Show
      If using --fp_single_precision_constant generates below error: "/db/sds11/build/release/ank/rel22_6_0_LTS/build/product/linux/include/stlport/s__limits.h", line 516: error: floating constant is out of range Then update this file with below changes    C:\compilers\ti-cgt-c2000_22.6.0.LTS\include\float.h Replace below: #define DBL_MIN 2.2250738585072014E-308 /* MIN NORMALIZED POS VALUE */ #define DBL_MAX 1.7976931348623157E+308 /* MAX POSITIVE VALUE */ With these updates to explicitly set suffix: #define DBL_MIN ((double)(2.2250738585072014E-308L)) /* MIN NORMALIZED POS VALUE */ #define DBL_MAX ((double)(1.7976931348623157E+308L)) /* MAX POSITIVE VALUE */

      Using options --fp_single_precision_constant with --abi=eabi for below test case
      file.cpp
      #include <string>
      std::string cpp_string;

      that ultimately includes float.h which uses DBL_MIN and DBL_MAX will generate below errors:

      % cl2000 --fp_single_precision_constant --abi=eabi --verbose_diagnostics file.cpp
      "C:\ti\compilers\ti-cgt-c2000_22.6.0.LTS\include\stlport\s__limits.h", line
      516: error: floating constant is out of range
      static double (_STLP_CALL min)() _STLP_NOTHROW

      { return DBL_MIN; }

      ^
      "C:\ti\compilers\ti-cgt-c2000_22.6.0.LTS\include\stlport\s__limits.h", line
      521: error: floating constant is out of range

      { return _STLP_DBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_D_denormMin() : DBL_MIN; }

      ^
      "C:\ti\compilers\ti-cgt-c2000_22.6.0.LTS\include\stlport\s__limits.h", line
      523: error: floating constant is out of range
      static double (_STLP_CALL max)() _STLP_NOTHROW

      { return DBL_MAX; }

      ^
      3 errors detected in the compilation of "file.cpp".

      If --fp_single_precision_constant is not used, it builds clean.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: