#1198 sign(2.0*x) evaluates x too many times

closed
5
2007-12-29
2007-05-24
No

aaa:'bbb$
bbb:'ccc$
ccc:23.5$

sign(aaa) => PNZ OK
sign(bbb) => PNZ OK
sign(2*aaa) => PNZ OK
sign(1.0*aaa) => POS !!!
sign(1.0*bbb) => POS !!!

This is yet another case of EV being misused in the middle of code that has no business doing an evaluation, in this case in compar.lisp, function numer.

Adding the noeval flag does not fix the problem -- though sign(1.0*aaa) is now PNZ, sign(1.0*bbb) is still POS.

$float is better, though a fix is needed to $float for the 2^%pi case.

Discussion

  • Dan Gildea

    Dan Gildea - 2007-12-29
    • status: open --> closed
     
  • Dan Gildea

    Dan Gildea - 2007-12-29

    Logged In: YES
    user_id=1797506
    Originator: NO

    Seems to have been fixed in compar.lisp rev 1.27.

    (%i2) aaa:'bbb$
    (%i3) bbb:'ccc$
    (%i4) ccc:23.5$
    (%i5) sign(aaa);
    (%o5) pnz
    (%i6) sign(bbb);
    (%o6) pnz
    (%i7) sign(2*aaa);
    (%o7) pnz
    (%i8) sign(1.0*aaa);
    (%o8) pnz
    (%i9) sign(1.0*bbb);
    (%o9) pnz

     

Log in to post a comment.