help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] possible bug for vectors and matrices


From: Jerome BENOIT
Subject: Re: [Help-gsl] possible bug for vectors and matrices
Date: Sat, 02 Jun 2012 17:06:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Hello List:

On 02/06/12 15:34, Rhys Ulerich wrote:
Hi Jerome (and bug-gsl added on CC),

I have just gone through some gsl_(vector|matrix)_TYPE.h headers (with
TYPE=long, long_double, ...). Functions that scale by or add a
constant has a *double* as constant argument: should this argument
constant not be in type TYPE rather than in type double?

Just to be concrete, you're saying all of

int gsl_vector_long_double_scale (gsl_vector_long_double * a, const double x);
int gsl_vector_long_double_add_constant (gsl_vector_long_double * a,
const double x);
int gsl_matrix_long_double_scale (gsl_matrix_long_double * a, const double x);
int gsl_matrix_long_double_add_constant (gsl_matrix_long_double * a,
const double x);
int gsl_matrix_long_double_add_diagonal (gsl_matrix_long_double * a,
const double x);

Indeed I meant these one, but also the other alike ones:

int gsl_vector_long_scale (gsl_vector_long * a, const double x);
int gsl_vector_long_add_constant (gsl_vector_long * a, const double x);

and so forth.


should be taking long doubles as their second argument?  Likewise for
other types?  I agree.

For anything "smaller" than double I doubt that the bug will cause a
loss of precision.

For consistency, it makes sense;
second, as regard the source/implementation part,
as noticed above, it would be simpler to just play
with the adequate type.

  But for long doubles and above it is indeed a
problem.  Either way, the API isn't right.

That was my point.


Anyone have an objection if I throw this in a ticket on savannah and
take a stab at fixing it by correcting the templating?  (I think the
right template macro is BASE rather than TYPE, but that's an
implementation detail).


- Rhys

Jerome



reply via email to

[Prev in Thread] Current Thread [Next in Thread]