Re: RosettaCode factorial needs to use longs

2014-03-09 Thread Russel Winder
On Sat, 2014-03-08 at 21:20 +, bearophile wrote: Jay Norwood: http://rosettacode.org/wiki/Factorial#D to whomever is maintaining these: Need to change all ints to longs in this example to get the displayed results since the 15! result requires more than 32 bits. I am

Re: RosettaCode factorial needs to use longs

2014-03-09 Thread bearophile
Russel Winder: That page appears to quietly ignore the fact that those languages that use hardware integers cannot correctly compute factorial(25), The D entry has the same problem. But a pre-condition could be added to limit the input. I wonder though if it would be better to split the

Re: RosettaCode factorial needs to use longs

2014-03-09 Thread Russel Winder
On Sun, 2014-03-09 at 10:28 +, bearophile wrote: Russel Winder: That page appears to quietly ignore the fact that those languages that use hardware integers cannot correctly compute factorial(25), The D entry has the same problem. But a pre-condition could be added to limit the

Re: RosettaCode factorial needs to use longs

2014-03-09 Thread bearophile
Russel Winder: It might be a good move to collect together all the URLs of codes like this so that there is a quick way of reviewing and providing feedback. Minimizing effort to do reviewing makes it more likely to happen. Code like what? What URLs? Currently I am maintaining about 850 D

RosettaCode factorial needs to use longs

2014-03-08 Thread Jay Norwood
http://rosettacode.org/wiki/Factorial#D to whomever is maintaining these: Need to change all ints to longs in this example to get the displayed results since the 15! result requires more than 32 bits.

Re: RosettaCode factorial needs to use longs

2014-03-08 Thread Jay Norwood
After changing to longs, I made some test loops, and on release build dmd, pc, these are the relative times I measured for the different versions of factorial in that example. So the iterative wins, and the functional style results in 4x penalty in this case. duration factorial (hnsecs)=98

Re: RosettaCode factorial needs to use longs

2014-03-08 Thread bearophile
Jay Norwood: http://rosettacode.org/wiki/Factorial#D to whomever is maintaining these: Need to change all ints to longs in this example to get the displayed results since the 15! result requires more than 32 bits. I am maintaining the D entries, I have fixed that factorial code, thank