优化多边形算法中的《boost::polygon::detail::robust_fpt测试程序》
在优化多边形算法中,robust_fpt是一个非常重要的概念。它是一个精度可控的浮点类型,可以避免浮点误差带来的问题。在实际的应用中,我们需要对robust_fpt进行一些测试,以保证其正确性和稳定性。本文将介绍如何编写一个测试程序,来对robust_fpt进行测试。
首先,我们需要定义一个robust_fpt类型:
class robust_fpt {
public:
robust_fpt();
robust_fpt(double v);
robust_fpt operator+(const robust_fpt& x) const;
robust_fpt operator-(const robust_fpt& x) const;
robust_fpt operator*(const robust_fpt& x) const;
robust_fpt operator/(const robust_fpt& x) const;
bool operator==(const robust_fpt& x) const;
friend std::ostream& operator<<(std::ostream& os, const robust_fpt& x);
private:
d