This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

round result of floating point calcualtion

Hello,

I have a problem with the accuracy of the result when I divide 2 float values.

This is the line in my source Code:

 dds_word.long_dds = 2.147483648E16 / 7.1312E7 

The result which I get is 3.011392E8

The unrounded result is 3.0113916845E8

There is no difference when I work with float or double variables. Is there any possibility to get more accuracy?

Parents
  • Well, as some people like to say: "if you have to ask, you're probably not up to it."

    Implementing your own floating point arithmetics packages is a huge effort.
    Are you sure you really need more than 6 digits? Are you really handling data that have an accuracy on other order of 1 ppm? And if so, why would you use a cheap 8051 to handle it --- sensors of that quality cost enough that the price of a higher-performance chip to control them would never be noticed.

Reply
  • Well, as some people like to say: "if you have to ask, you're probably not up to it."

    Implementing your own floating point arithmetics packages is a huge effort.
    Are you sure you really need more than 6 digits? Are you really handling data that have an accuracy on other order of 1 ppm? And if so, why would you use a cheap 8051 to handle it --- sensors of that quality cost enough that the price of a higher-performance chip to control them would never be noticed.

Children