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.

Compiler/AM5728: Floating Point Precision Issue in DSP for processor ti am5728

Part Number: AM5728


Tool/software: TI C/C++ Compiler

Hello,

After the mathematical calculation in DSP of am5728 (ti-processor-sdk-rtos-am57xx-evm-05.02.00.10), my value is stored in float variable but its decimal place changes.

Below is the code :

#define DECIMAL_PLACES 100

int x = 166, y = -320;

float a,b, c, d;

a = divdp(x, DECIMAL_PLACES);

b = divdp(y, DECIMAL_PLACES);

c = divsp(x, DECIMAL_PLACES);

d = divsp(y, DECIMAL_PLACES);

i get the same result in a and c , b and d i.e.

Result, a = 1.6599, b = -3.1900, c = 1.6599, d = -3.1900;

Even though value is within the range of float its decimal precision changes. We tried both divdp and divsp but results are the same. What is required to get the same value in float.  i.e 

Required Result should be a & c = 1.66 and b & d = -3.20.

Regards,

Kushal