http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57396

--- Comment #1 from Lorenz Hüdepohl <bugs at stellardeath dot org> ---
As the loop is quite confusing, i wrote a small python program to reproduce the
correct result:

> cat test.py
def foo(n):
    r = {}
    a = {}

    # initialize with some dummy values
    for i in range(-n, n + 1):
        for j in range(-n, n + 1):
            a[(i,j)] = j
            r[(i,j)] = j + 1

    # here be dragons
    for k in range(0, n + 1):
      dj = r[(k, k - 2)] * a[(k, k - 2)]
      r[(k,k)] = a[(k, k - 1)] * dj

    # print it out
    print "{0:12.8f}".format(r[(0,0)])

foo(5)
> python ./test.py
 -2.00000000
>

Reply via email to