Menu

Bug Equation Solver

2011-04-13
2012-12-27
  • mastertrenten

    mastertrenten - 2011-04-13

    Hi,

    If you execute the following code

    lol=1.0-0.1-0.25;
    monitor=lol;
    

    milkdrop will return the correct answer: 0.6500 (thus with (1.0-0.1)-0.25)
    projectm will return 1.1500 (thus with 1.0+(-0.1-0.25))

    the same for other operators etc.

    Can somebody confirm this or is project m dead?

     
  • mastertrenten

    mastertrenten - 2011-04-13

    I mean projectm does this 1.0- (0.1-0.25)

     
  • mastertrenten

    mastertrenten - 2011-04-13

    I think it is solved by changing in Parser.cpp line 1016 (so it also changes the root of the expressension if you have the same operator as before)
    from

    1016      if (infix_op->precedence > (*root)->infix_op->precedence)
    1017      {
    1018        new_root = new TreeExpr(infix_op, NULL, *root, NULL);
    1019        (*root) = new_root;
    1020        return new_root;
    1021      }
    

    to

    1016      if (infix_op->precedence >= (*root)->infix_op->precedence)
    1017      {
    1018        new_root = new TreeExpr(infix_op, NULL, *root, NULL);
    1019        (*root) = new_root;
    1020        return new_root;
    1021      }
    

    tests:
    1.0-0.1-0.25      = 0.65 (correct) instead of 1.15
    -0.25/-1.78/-0.76/5.0    = -0.0370 (correct) now instead of -0.5337

    etc.

     
  • Carmelo Piccione

    Fixed in trunk r1363. Thanks for finding this. Do you know of any presets this fixes?

     

Log in to post a comment.