Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×

Comment Re:Vectorized factorials! (Score 4, Funny) 225


Here is how I do a factorial function. No recursion, no loops, no vectorization needed. It's in Java. Converting this basic idea to C is left as an exercise for advanced readers.

        static public long factorial( int n ) {
                switch( n ) {
                        case 0:
                        case 1: return 1L;
                        case 2: return 2L;
                        case 3: return 6L;
. . . cases 4 to 18 omitted to bypass slashdot filters . . .
                        case 19: return 121645100408832000L;
                        case 20: return 2432902008176640000L;
                }
                return 0L;
        }

Comment Re:Very different code (Score 2) 225

> And trying to do it all yourself is a risk of never getting to market.

You don't have to maintain the compiler yourself. You just need to have source code to it, and a compiler that compiles it, for the life of your project. That way, if a newer version of the compiler breaks your project, as the original poster complained of, you always have a working compiler for the life of your project. Your compiler may not get any additional improvements. But having it work vs not work is much more important than incremental improvements.

Comment Re:Wife (Score 1) 327

> You married a lump of wood?

Hey now, there's nothing wrong with wood. Especially in the mornings. Wood in the mornings is best.

Yes morning wood saves electricity, but I worry about how much CO2 is in the smoke that goes up the chimney as the wood is burned in the stove.

Comment Re:The score so far (Score 5, Funny) 199

> Penalty for infringing on copyrights: uncounted billions.

Uh, excuse me, sir. It was $75 TRILLION. Not mere Billions. Google it: RIAA $75 TRILLION.

Oh, wait, but this is about movies rather than music. Nevermind. It's all okay then. :-(

This may be more than the global GDP, but music is worth it. If you FEEELTHY pirates can't pay $75 trillion because there's not enough wealth on the planet, then you shouldn't listen to the music. Better yet, all music should be locked up where nobody can ever hear it again -- to protect the artists.

Slashdot Top Deals

If you have a procedure with 10 parameters, you probably missed some.

Working...