Announcement

Collapse
No announcement yet.

Strange Calculation bug !

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strange Calculation bug !

    Open a blank efs ant type :

    debugClear();
    debugPrintln(1999*100000000);
    debugPrintln(2000*100000000);
    debugPrintln(2001*100000000);
    debugPrintln(2002*100000000);
    debugPrintln(2003*100000000);
    debugPrintln(2004*100000000);
    debugPrintln(2005*100000000);
    debugPrintln(2006*100000000);
    debugPrintln(2007*100000000);
    debugPrintln(2008*100000000);

    The formula Output Window returns

    No Syntax Errors

    2007:0000000
    200700000000
    200600000000
    200500000000
    2003:0000000
    200300000000
    2001:0000000
    2000:0000000
    1:0000000000
    199900000000

    I use esignal8 Build 782.

    So in short, ask esignal :

    2002*100000000

    and it gives :

    2001:0000000

    Any explanation ?
    Last edited by silvermotion; 09-19-2008, 11:45 AM.

  • #2
    Re: Strange Calculation bug ! For esignal, 2002*100000000 = 2001:0000000 !

    Hi silvermotion,

    I'm running version 10.2 and did not have this issue, however, I believe what you are seeing here is likely an issue with the JavaScript engine and parenthesis resolution.

    Your mathematical expression is not enterpreted correctly since the debugPrintln() function is meant to output strings.

    Try this:



    debugClear();
    debugPrintln("1");
    debugPrintln(1999*100000000);
    debugPrintln(2000*100000000);
    debugPrintln(2001*100000000);
    debugPrintln(2002*100000000);
    debugPrintln(2003*100000000);
    debugPrintln(2004*100000000);
    debugPrintln(2005*100000000);
    debugPrintln(2006*100000000);
    debugPrintln(2007*100000000);
    debugPrintln(2008*100000000);

    debugPrintln();
    debugPrintln("2");
    debugPrintln((1999*100000000));
    debugPrintln((2000*100000000));
    debugPrintln((2001*100000000));
    debugPrintln((2002*100000000));
    debugPrintln((2003*100000000));
    debugPrintln((2004*100000000));
    debugPrintln((2005*100000000));
    debugPrintln((2006*100000000));
    debugPrintln((2007*100000000));
    debugPrintln((2008*100000000));


    debugPrintln();
    debugPrintln("3");
    debugPrintln(" "+(1999*100000000));
    debugPrintln(" "+(2000*100000000));
    debugPrintln(" "+(2001*100000000));
    debugPrintln(" "+(2002*100000000));
    debugPrintln(" "+(2003*100000000));
    debugPrintln(" "+(2004*100000000));
    debugPrintln(" "+(2005*100000000));
    debugPrintln(" "+(2006*100000000));
    debugPrintln(" "+(2007*100000000));
    debugPrintln(" "+(2008*100000000));



    Originally posted by silvermotion
    Open a blank efs ant type :

    debugClear();
    debugPrintln(1999*100000000);
    debugPrintln(2000*100000000);
    debugPrintln(2001*100000000);
    debugPrintln(2002*100000000);
    debugPrintln(2003*100000000);
    debugPrintln(2004*100000000);
    debugPrintln(2005*100000000);
    debugPrintln(2006*100000000);
    debugPrintln(2007*100000000);
    debugPrintln(2008*100000000);

    The formula Output Window returns

    No Syntax Errors

    2007:0000000
    200700000000
    200600000000
    200500000000
    2003:0000000
    200300000000
    2001:0000000
    2000:0000000
    1:0000000000
    199900000000

    I use esignal8 Build 782.

    So in short, ask esignal :

    2002*100000000

    and it gives :

    2001:0000000

    Any explanation ?
    Last edited by Guest; 09-19-2008, 01:38 PM.

    Comment


    • #3
      My output with the previous code was as follows:

      1
      199900000000
      200000000000
      200100000000
      200200000000
      200300000000
      200400000000
      200500000000
      200600000000
      200700000000
      200800000000

      2
      199900000000
      200000000000
      200100000000
      200200000000
      200300000000
      200400000000
      200500000000
      200600000000
      200700000000
      200800000000

      3
      199900000000
      200000000000
      200100000000
      200200000000
      200300000000
      200400000000
      200500000000
      200600000000
      200700000000
      200800000000


      Hope this helps.

      Comment


      • #4
        stevehare2003, thank you for your answer.

        On esignal8, doing

        var test = 2002*100000000;
        debugPrintln(test);

        outputs

        2001:0000000

        I have checked with esignal10, and the calcualtion is ok, as you highlighted. While this solves my problem, and i m very happy for that, i ve been dreading upgrading to esignal10 due its higher ressource usage.
        It would be nice, however to have an explanation as far as esignal 8 is concerned.

        Comment


        • #5
          silvermotion
          I believe the problem was due to a JavaScript buffer overflow that was fixed after version 8 and that up to then could be resolved using the .toFixed() method as you can see in the enclosed screenshot
          Alex




          Originally posted by silvermotion
          Open a blank efs ant type :

          debugClear();
          debugPrintln(1999*100000000);
          debugPrintln(2000*100000000);
          debugPrintln(2001*100000000);
          debugPrintln(2002*100000000);
          debugPrintln(2003*100000000);
          debugPrintln(2004*100000000);
          debugPrintln(2005*100000000);
          debugPrintln(2006*100000000);
          debugPrintln(2007*100000000);
          debugPrintln(2008*100000000);

          The formula Output Window returns

          No Syntax Errors

          2007:0000000
          200700000000
          200600000000
          200500000000
          2003:0000000
          200300000000
          2001:0000000
          2000:0000000
          1:0000000000
          199900000000

          I use esignal8 Build 782.

          So in short, ask esignal :

          2002*100000000

          and it gives :

          2001:0000000

          Any explanation ?

          Comment

          Working...
          X