#1379 0.0 + [0] ---> [0]

closed
nobody
4
2010-06-04
2008-03-30
No

OK:

(%i1) 0.0 + 0;
(%o1) 0.0

Not OK; (%o2) should be [0.0], not [0]

(%i2) 0.0 + [0];
(%o2) [0]

Also, 0.0b0 + [0] ---> [0]. Matrix addition has the same bug:

(%i6) 0.0 + matrix([0,0]);
(%o6) matrix([0,0])

Discussion

  • Robert Dodier

    Robert Dodier - 2008-04-19

    Logged In: YES
    user_id=501686
    Originator: NO

    I'm guessing that the behavior 0.0 + [0] => [0] comes from the same place as 0.0 + foo => foo, 0.0 + foo(x) => foo(x). Maybe we should disallow the simplification (inexact zero) + (whatever) => (whatever). Not sure what we should do at this point.

     
  • Dieter Kaiser

    Dieter Kaiser - 2010-06-04

    Fixed in simp.lisp revison 1.111. We get

    (%i2) 0.0+[0];
    (%o2) [0.0]
    (%i3) 0.0+matrix([0,0]);
    (%o3) matrix([0.0,0.0])

    Closing this bug report as fixed.
    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2010-06-04
    • status: open --> closed
     

Log in to post a comment.