0 Replies Latest reply on Jul 24, 2007 11:38 PM by miquael

    problem with infinite numbers

    miquael Level 1
      I'm having a problem with dealing with positive and negative infinite numbers. Here is the code:

      for (i=(_root.totalFrameNodes); i<_root.totalNodes; i++) {
      u = v = _root.uvDefined;
      x = _root.xResult;
      y = _root.yResult;

      lambda = (Math.sqrt((x) + (y)) - R0) * (1/R1);

      if (isFinite(lambda) == false) {
      if (lambda == Number.POSITIVE_INFINITY) {
      trace ("result = " + lamba);
      lambda = 0.9;
      }
      if (lambda == Number.NEGATIVE_INFINITY) {
      trace ("result = " + lamba);
      lambda = -0.9;
      }
      } else if (isNaN(lambda)) {
      lambda = 0;
      }
      trace ("i = " + i + " ; lambda = " + lambda);
      _root.zPosArray = lambda(_root.zResult);
      }
      }

      The results are that, although in some cases LAMBDA registers as NON FINITE, it will not register as either POSATIVE_INFINITY or NEGATIVE_INFINITY, and in all these cases LAMBDA registers as NaN.

      Can anyone help?