ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

@benthebear93, that is the natural behaviour of floating points numbers, it a representationm problem.

  1. Doubles AKA float64 can store technically up to 16 significant digits, so you can try to use floats AKA float32 that stores only 7.
  2. You can round the number to the decimal digit you want with, asumming you are using C++: round(value * 1000) / 1000; That is rounder the value number to the 4th decimal digit. So the number -9.08240001381 will be -9.0824.

But at the end of the day you will have decimals that you do not want since thats is how floating point representation works.

If anyone knows any other trick to solve this problem I will glad to discuss it here.

Regards.