
detail/functions/pow.hpp:
* line 18 ff: pow_imp I don't like the fact that this implementation creates log2(p) temporaries on the stack and multiplies them all together on the way out of the recursion. I'd prefer to only use a constant number of temporaries.
* line 31: I don't see how the cases > 1 buy you anything. They don't change the number of calls to eval_multiply. (At least, it wouldn't if the algorithm were implemented correctly.) * line 47: ???: The work of this loop is repeated at every level of recursion. Please fix this function. It's a well-known algorithm. It shouldn't be hard to get it right.
Chris?
Good suggestion. The function has been rewritten in the sandbox using the S-and-X binary method, as described in D. E. Knuth, "The Art of Computer Programming", Vol. 2, Section 4.6.3. Oh no, I put it in the sandbox. I should have fixed it locally, as we are in a review. My bad. I am sorry if this is wrong. John, a merge with your checked out copy will be needed. <snip>
* line 351: if(t.compare(fp_type(2) / fp_type(3)) <= 0) Is the rounding error evaluating 2/3 important? I've convinced myself that it works, but it took a little thought. Maybe add a comment to the effect that the exact value of the boundary doesn't matter as long as its about 2/3?
Not sure, Chris?
I need to look at this function more closely. It needs more comments through-and-through. I will perform some boundary checking and add comments. I need a day or two for this change request. <snip>
Many thanks for the detailed comments, John.
Thanks for the great suggestions, Chris.