redundant apts[:,i]-apts[:,i] expressions

Issue #4 new
Nico Schlömer created an issue

Lines like https://bitbucket.org/fenics-project/fiat/src/550063505522529f9a6c3875007a3c0277d819f0/FIAT/newdubiner.py?at=master#cl-145

results[0,:] = 1.0 + apts[:,0]-apts[:,0]+apts[:,1]-apts[:,1]+apts[:,2]-apts[:,2]

look buggy

0 == apts[:,0]-apts[:,0] + apts[:,1]-apts[:,1] + apts[:,2]-apts[:,2]

There are more of the same kind, e.g., https://bitbucket.org/fenics-project/fiat/src/550063505522529f9a6c3875007a3c0277d819f0/FIAT/expansions.py?at=master#cl-143.

Comments (1)

  1. Miklós Homolya

    With floating-point arithmetics (1.0 + x) - x doesn't always equal to 1.0, it can also be 0.0, NaN, and maybe other values between 0 and 1. That said, I don't know what the author's intention was.

  2. Log in to comment