ruby: fix Eigen::Vector3.assign=

Would not like that (would be yet another magic number, only one with a
name). The problem is the ruby-C++-ruby convertion which I assume can
introduce errors (I actually don't know if it does ...). The two better
options would be to use assert_in_delta (which has a relative error, so not
working if we compare to zero), or use Float::EPSILON. However, I don't
know enough about FP computations to know which operations are speced to
give results within EPSILON of the expected result.

I would go with using EPSILON as long as it works and "think" later if it
stops working on some architectures.

Opinion ?


2014-06-16 8:41 GMT+02:00 Matthias Goldhoorn <notifications@github.com>:

> In bindings/ruby/test/test_vector3.rb:
>
> > @@ -48,5 +48,11 @@ def test_dup
> >          new = v.dup
> >          assert((v - new).norm < 0.0001)
> >      end
> > +
> > +    def test_data_assign
> > +        v = Eigen::Vector3.new(0, 0, 0)
> > +        v.data = [1, 2, 3]
> > +        assert((Eigen::Vector3.new(1, 2, 3) - v).norm < 0.00001)
>
> Should we not add something Base::Sigma instead of using "magic" numbers
> here?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/rock-core/base-types/pull/1/files#r13793058>.
>