0

I saw a question at rule for posting programmers vs stackoverflow. Still I could not get my head around that.

I have a question specific to some programming language (Python), possibly a bug. But I am not sure as to where should I post the question. How do I decide that?

Should I post my question here so that I can get help in deciding on an answer to my query?

Let me post the question anyway.

import numpy as np
g = [1.1,1.2,1.3]
for j in np.arange(len(g)):
    c = 0
    for k in np.arange(len(g)-1,j,-1):
        if (g[j]-g[k])**2 < 0.01:
            c += 1
            h.append(g[k])
            print 0.01-(g[j]-g[k])**2      # line 9
            g.pop(k)

#            print 'g=', g,',length=',len(g),'\n'
#    length = len(g)
    print 'g[j],c=',g[j],c

The problem I am facing here is that the difference I asked to print at line 9 should be zero. But I am getting 2.60208521397e-17. I have been scratching my head over this for long. "

6

If your question is about writing code in your favorite editor, ask it on Stack Overflow.

If your question is about designing software while you're standing in front of a white board, ask it on Programmers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .