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.

TMS320F28035: The value of CLA float point variable is not right in Expression window

Part Number: TMS320F28035

Hi Expert,

The below figure is the test result by customer's. There's some confusions about the value and float type.

  • Why the "aa" in "Expressions" window is not the same with the value "133,333,336.0" in "Memory Browser"?

            I did the same test using F28035 control card, however the "aa" value of "Expressions" and "Memory Browser" are same as "133,333,336.0".

            Why does this happen?

  • Why the "aa" value change to "133,333,336.0" not "133,333,328.0", if consider the IEEE 745 Standard for Floating-Point Arithmetic?  

  • Hi Expert,

    If change the data type to 32-bit unsigned int in Memory Browser, the data value is same with "aa" in "Expressions". So in "Expressions" window, the "aa" value is shown as unsigned type actually.

    Customer tests using CCS v8, while I use CCS7.4.

    Could you please help to explain the issue and suggest the right way to avoid it? Thanks!

    Best Regards

    Rayna

  • Hi Expert,

    If change the data type to 32-bit unsigned int in Memory Browser, the data value is same with "aa" in "Expressions". So in "Expressions" window, the "aa" value is shown as unsigned type actually.

    Customer tests using CCS v8, while I use CCS7.4.

    Could you please help to explain the issue and suggest the right way to avoid it? Thanks!

    Best Regards

    Rayna

  • Please try right clicking on the value in the expressions window. Select number format -> default.  Does that change the value to float?

    Regards

    Lori

  • Lori Heustess said:
    Please try right clicking on the value in the expressions window. Select number format -> default.  Does that change the value to float?

    Yes, this looks to be the solution: Please see the below screenshot for an example on how to change it

  • Why the "aa" value change to "133,333,336.0" not "133,333,328.0", if consider the IEEE 745 Standard for Floating-Point Arithmetic?  

    Single precision has two nearest to 133,333,333.0 representable values: 133333328 and 133333336. Obviously 133333336 is closer to your request. AFAIK neither IEEE745 or C standards disagree with this. Run time conversion from integer to float should follow active rounding mode (off / to nearest / towards +ve infinity / to wards -ve infinity). C standards says it's implementation defined and restricts only backwards conversion from FP to int to always drop fractional part.

    Edward