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.

TMS320F28379D: rounding number

Part Number: TMS320F28379D

Hi, I'm testing the rounding mode on 28379d launchpad.

I write below code in both CPU and CLA.

int a=0;

a=a+11.5.

After running the code, I get a=11.

In CLA, i add the code  

__asm(" MSETFLG RNDF32=1");

and it sets the rounding mode to round to nearest even. and I suppose to get a=12, but it's still 11.

In CPU, i add the code

__asm(" SETFLG RNDF32=1");

and it also sets the rounding mode to round to nearest even. I suppose to get a=12, but it's still 11.

why?

  • Hi howard,

    whatever you are seeing is because of type casting in C.

    Basically it works that way. You can see an example here.

    So basically you are rounding 11. And that gives same answer.

    Hope it helps

    Regards,

    Keyur