Closed v0dro closed 9 years ago
Thanks. I've merged your changes and updated rb_gsl_matrix_scale_bang
and rb_gsl_vector_scale_bang
as well. What about rb_gsl_{matrix,vector}_add_constant{,_bang}
, don't they also need fixing?
I'll investigate. Didn't get time to prod further yesterday. Will send a PR directly in a while.
No need for a PR. I'm ready to push (or revert), just need your confirmation.
Yes I think it should be NUMCONV2
over there as well.
Thanks, done.
Reason for fix: Previously the method was using
NUMCONV
, which resolved toFIX2INT
forGSL::Matrix::Int
orGSL::Vector::Int
. It would useFIX2INT
irrespective of whether the object being passed to it was aFixnum
or aFloat
. This, somehow caused a malfunction on my system (ruby 2.2.1 on rvm with debian 8 jessie) and the convertedINT
value would turn out to be garbage.Converting the
NUMCONV
toNUMCONV2
makes sure that the macro resolves toNUM2INT
forGSL::Matrix::Int
andGSL::Vector::Int
. This way, it is ensured that the object, whether aFloat
orFixnum
is appropriately converted to anINT
without error, since both are of typeNumeric
.No tests break now, and I think
NUMCONV2
would be more fool-proof too.