News for hackers. Stuff that matters.
Re:Calculating integer factorials in constant time, taking a... by hellofunk on Tuesday December 15, 2015 @09:01AM (#10737762)
I found this rather strange. Use of the word "calculate" is a bit of a stretch with dealing with a lookup table to get results. Worth reading, however.
Re:Calculating integer factorials in constant time, taking a... by mzl on Tuesday December 15, 2015 @09:19AM (#10737838)
The point is that the lookup table contains results for _all_ inputs to the function that have a defined result (that is, functions that do not trigger overflow and thus undefined behaviour). In that sense, it has the same semantics as the original function although most people would not suspect that.
Re:Calculating integer factorials in constant time, taking a... by dietrichepp on Tuesday December 15, 2015 @09:13AM (#10737810)
I don't think it's really a stretch. It's the classic tradeoff: space versus time. The results are the same.
Re:Calculating integer factorials in constant time, taking a... by bemmu on Tuesday December 15, 2015 @09:03AM (#10737772)
Well in the first example it's calculated, just at compile time.
Re:Calculating integer factorials in constant time, taking a... by liquidise on Tuesday December 15, 2015 @12:14PM (#10738934)
Watch it. i've "calculated" more than a few project euler solutions this way.