On 24 May 2016, at 10:21, Serge Stinckwich <serge.stinckwich@gmail.com> wrote:
Very nice article Sven !
Thanks, but it is just intro level (which is important too, of course).
Can you contribute your code to the PolyMath project under the MIT Licence (and maybe some tests) ?
It is only one method. You can copy it over if you want. I am not 100% happy with the selector name #productTo: either. And there should probably be some error checking in a facade method before going into the loop, like self assert: upper isInteger. self assert: (self between: 1 and: upper). Have you seen the Fast Factorial Functions website mentioned at the end ? http://www.luschny.de/math/factorial/FastFactorialFunctions.htm If I see that, I can only be very humble about the implementation in the article (which was based on some very old Lisp code that I had lying around - I did not come up with this myself). Sven
Thank you.
On Tue, May 24, 2016 at 8:57 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
I just published a short, introduction level article,
Speeding up factorial computation by changing the order of multiplications.
This is a story about a small, seemingly innocent code change that speeds up a very simple computation. It is pretty magical and serves as an example of how things are not always what they seem.
https://medium.com/concerning-pharo/speeding-up-factorial-computation-by-cha...
Enjoy,
Sven
-- Sven Van Caekenberghe Proudly supporting Pharo http://pharo.org http://association.pharo.org http://consortium.pharo.org
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/