Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Which loop is faster?

Name: Anonymous 2012-01-16 8:59


for (I = 0; I < N; I++)
  for (J = 0; J < M; J++)
    update(Xs[I][J]);

or

for (I = 0; I < N; I++)
  for (J = 0; J < M; J++)
    update(Xs[J][I]);

???

Name: Anonymous 2012-01-16 13:39

>>89
Uhh... because one is divisible by zero and the other isn't?
Nope. Neither is divisible by zero.

$ cat test.java

class test {
    public static void main(String[] args) {
        int herp = 3, derp = 0;
        System.out.println(herp % derp);
    }
}

$ java test
Exception in thread "main" java.lang.ArithmeticException: / by zero
        at test.main(test.java:4)


n mod 1 is always 0; n mod 0 is undefined, possibly resulting in a "Division by zero" error in computer programming languages

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List