On Wed, Jul 8, 2009 at 11:13 AM, smichr<[email protected]> wrote: > > > > On Jul 7, 10:38 am, Ondrej Certik <[email protected]> wrote: >> On Sat, Jul 4, 2009 at 6:52 PM, smichr<[email protected]> wrote: >> >> > I noticed that fastlog in evalf computes an approximation to log2(x). >> > Is there any reason not to call it fastlog2? >> >> Could you please be more specific? Which commands do you mean exactly? >> > > Maybe I'm not understanding the confusion, but I mean the fastlog > method in evalf: > > ### >>>> from sympy import * >>>> evalf.fastlog((0, 1, 2, 1)) #i.e. log(2**2)/log(2) = 2 > 2 > ### > > Since fastlog is computing the log2 approximation it makes sense to me > to call it fastlog2 rather than fastlog. > > There is no test for this function. I've remedied that and also > corrected the function to compute the power of an exact power of 2 > properly; previously it was off by 1 in the result. Since the mantissa > of all mpf numbers provided by mpf is suppose to be odd (according to > the documentation) then when the number is an exact power of 2, the > mantissa will be 1, the bitcount of it will also be 1 and the > approximation (exponent + bitcount) is off by 1: the bitcount should > not be added in this case.
Ah, yes, I think it should be called fastlog2. Fredrik, what do you think? > > If I can figure out how to push my changes to git I will send the > patch for this by that means. For now, I didn't change the name, I > only corrected the function and added tests. Yes, I am on IRC to help you out with github. Once you get it working, you'll see that it is easy. Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---
