storing float in yaml file using FileStorage stores in exponential format

asked 2018-04-23 12:03:53 -0600

infoclogged gravatar image

updated 2018-04-23 12:05:16 -0600

I am storing simple numbers such as 0.1 in the YAML file, but when I store them, they are stored as exponential format. Like

  • { x: 4.9395000000000000e+03, y: 12233. }

or

  • { x: 4.1999998092651367e+00, y: -1.0000000149011612e-01, occurence: 365 }

This makes the yaml file very unreadable. Is there any way, it can be avoided? And simply upto 4 decimals can be stored for example. I am saving cv::Point2f in the YAML file using cv::FileStorage and then fs >> cv::Point2f.

edit retag flag offensive close merge delete