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.

How to use the proper decimals in 28335?

In using 28335 FPU,sometimes I need to use the expression like :

Ualpha=1.0*sqrt(3);

In order to improve the program's efficiency I write the above expression into:

Ualpha=1.0*1.732050808;   //sqrt(3)=1.732050808

but Idon't sure how many decimals should I use in order to get the proper precision (Should I use 1.732051 or 1.732050808 or more decimals)?

P.S.   I use the watch window in CCS3.3 to  see the value of Ualpha=1.0*1.73205080, find that Ualpha=1.732051(only has 6 decimals).

          So,can I say that if I use 28335 FPU,  I only need to use 6 decimals?

Thanks!

  • Jack,

    The single precision FPU has 23 bits for the mantissa, which means that the maximum value of the mantissa is 2^23 = 8388608, hence you can have 7 significant decimal points, => both decimal and fraction included.

    so for 17.32051 you need to specify only 5 values beyond the fraction point,

    Hope this helps,

    Regards

    Manish Bhardwaj