Skip to content

Draft: fix: Fix float comparisons and eigen asserts

During usage of RLS faced with situation, that RLS raise Assert exceptions and inaccurate compares floating points values, which leads to errors.


Raised Eigen assert: https://gitlab.com/libeigen/eigen/-/blob/master/unsupported/Eigen/src/Polynomials/PolynomialSolver.h#L317

/** Computes the complex roots of a new polynomial. */
template <typename OtherPolynomial>
void PolynomialSolver<OtherPolynomial>::compute(const OtherPolynomial& poly) {
    eigen_assert(Scalar(0) != poly[poly.size() - 1]);
    eigen_assert(poly.size() > 1);
    ...

To fix the issue and satisfy Eigen's requirements for input arguments, I shrunk the size of OtherPolynomial by removing trailing zeros.


Log error message about wrong comparison of floating point numbers:

C++ exception with description "Error: Object found @ s=46.752474, but length of road is 46.752474" thrown in the test body.

This error was caused by an equality comparison of floating points values, so I added a tolerance window for comparison.

Edited by Daniil Nikulin

Merge request reports

Loading