On Thu, Oct 27, 2011 at 3:30 PM, Joachim Durchholz <j...@durchholz.org> wrote: > Am 27.10.2011 18:38, schrieb Aaron Meurer: >> >> So actually, using float() is probably cleaner than using int() as I >> had previously suggested, because to really do it correctly, you would >> actually have to use floor() and ceil(). So go ahead and just use >> that. There really isn't much concern with it since you are just >> comparing it (maybe someone can correct me if I am wrong). > > I'm doing it with unit tests :-) > And, yes, most of the times it's just comparing, but there are the > occasional situations where you have array slices and such. Which is what > caused the bug report in the first place.
Oh, well in that case, I guess you will have to cast to int(). > > I'm a wee bit concerned about performance. > Is there any code that uses functions from generate.py a really large number > of times? Other than the rest of the ntheory module, the only one I found that uses those functions is factorial. I know we do use the prime factorization algorithm in the core to simplify radicals (like sqrt(16*3)), so if that uses these, it might be important. Though I think the fact that it uses a cached sieve should keep the performance reasonable. If you are concerned, you can put a print statement in the code somewhere and run the test suite (./bin/test), and that should show you what parts of the code if any are using that part of the code. Then you can compare the times for before and after your changes for those tests. What exactly concerns you by the way? Things like int(0.1) or even ceil(0.1) are going to be very fast. Aaron Meurer > > Regards, > Jo > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.