[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] logic error logarithms
From: |
Thomas Weber |
Subject: |
Re: [Help-gsl] logic error logarithms |
Date: |
Wed, 18 Jan 2006 21:49:17 +0100 |
HI,
Am Mittwoch, den 18.01.2006, 08:19 -0800 schrieb yperez_riverol (sent by
Nabble.com):
> I want calculate logarithms base 2 of x.
> for this my code is:
>
> result = (gsl_sf_log(x)/gsl_sf_log(2));
First guess: result is an integer (which explains why you get 6 and not
6.6439)
> when x=100 the logic result=2, but the program show me 6.
Huh? The log2 of 100 is the number y, which fulfills
2^y = 100.
So y=2 is quite obviously not the correct solution (unless you have a
very special logic).
Regards
Thomas