This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

double vs. float

Other Parts Discussed in Thread: MSP430F5529

Code Composer 4 ... MSP430 ... I found that a double value is ignored ... although there is no error when it compiles:

Example:

double dx = 15; ... result: dx equals 0.

float fx = 15; ... result: fx equals 15.

  • Hi Clyde,

    Are you using the latest version of CCSv4 (4.2.5)? I believe it has been resolved in that version. There is also no issue with my CCSv5.1 install.

    Thanks

  • 4.2.5 seems to have no issues either

  • I have tried Code Composer 5 ... found Code Composer 5 bugs when compiling MSP430 code.

    Are you indicating that your Code Composer 4.2.5 flags double as an error?

    If not, then are you indicating your results are different from my results?

  • Clyde Eisenbeis said:
    Are you indicating that your Code Composer 4.2.5 flags double as an error?

    I do not get any error. Application compiles fine and the value of the double type variable ("dx" in your example) is as expected.

    Could you attach a small, reproducible test case? Also let me know what version of the compiler you are using.

    Thanks

    ki

  • A zip file containing the code and image is attached.  The contents of the code are:

    #include <msp430f5529.h>
    void main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;
      double dx = 15;// ... result: dx equals 0.
      float fx = 15;// ... result: fx equals 15.
    }

    I'm using version 4.2.4.  Is there a way to update only Code Composer 4?  The last time I selected update, it install Code Composer 5 along with a bunch of other programs I did not want ... burned a few hours deleting them and restoring Code Composer 4. 

    DoubleFloat.zip
  • Hi Clyde,

    Thanks for the zip, esp the screenshot. Could you try flipping the format for the variables for 'hexadecimal' to 'natural' or 'decimal' and see if it says '15.0' for dx? I am seeing this behavior myself - it says 0 for hexadecimal for 15.0 for decimal. When I look at memory via the memory view, it seems to have the correct value. Looks like CCS is not properly displaying double types when the format is hex in the locals view.

    Clyde Eisenbeis said:
    I'm using version 4.2.4.  Is there a way to update only Code Composer 4? 

    You can download the 4.2.5 patch separately and then do a local update. You can get the patch from:

    http://processors.wiki.ti.com/index.php/Download_CCS#Code_Composer_Studio_Version_4_Downloads (look under the 4.2.5 entry)

    Thanks

    ki

  • This problem should be reported to the appropriate people.

    I downloaded and started the install ... it appears to install everything, not just a patch, so I aborted ... don't want to lose all of my settings.  Is a patch available?

  • Clyde Eisenbeis said:
    This problem should be reported to the appropriate people.

    Already done. I assume you saw the same issue I did then ('decimal' works while hex shows incorrect values)

    Clyde Eisenbeis said:
    I downloaded and started the install ... it appears to install everything, not just a patch, so I aborted ... don't want to lose all of my settings.  Is a patch available?

    The link on the download page is the patch update. We actually do not have the full install available for download, just the patch. If you ended up downloading a file called 'CCS4.2.5.00005_update.zip', then that is the patch. Just extract and run the 'CCS_Update_4.2.5.00005.exe' file found in one of the sub-directories. The installer will run and ask for an installation directory. Point it to your root CCS installation.

    Thanks

    ki