bug-gsl
[Top][All Lists]
Advanced

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

Re: [Bug-gsl] About GSL


From: Patrick Alken
Subject: Re: [Bug-gsl] About GSL
Date: Tue, 02 Sep 2014 11:22:23 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

Thanks for your report, I've fixed the spelling error on the git repository.

For the (n % 2) vs (n & 1) issue, there is a good discussion at:

http://stackoverflow.com/questions/160930/how-do-i-check-if-an-integer-is-even-or-odd

The consensus seems to be that:

1) Most modern compilers will produce identical output for the two cases
2) n & 1 may not work on negative numbers, while n % 2 is guaranteed to work correctly

On 09/02/2014 10:01 AM, Guillaume Gomez wrote:
Hello,

I'm currently binding the GSL into Rust (when this part is finished, I'll
try to totally port the code). You can follow the development on github on
this link if you want : https://github.com/GuillaumeGomez/rust-GSL

But here's what's made contact you : while I was looking at the source, I
saw that sometimes, you use code like that :

int n;
if (n % 2 == 0)

Why this instead of :

int n;
if (n & 1 == 0)

? The second way is a little faster if I'm not wrong.

Another thing : for example in the function gsl_integration_qawc, there is
a little mistake in an error message :

"tolerance cannot be acheived with given epsabs and epsrel". Acheived
should be achieved if I'm not wrong.

Thanks in advance for you answer.

Cordially.





reply via email to

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