4 Replies Latest reply on Jan 25, 2008 1:35 PM by reinhat

    Need urgent help! How to check if the generated number is a whole number

    reinhat
      Hi,
      I have a simple issue but I need some assistance. I am calculating a number and the result number sometimes a whole number but in some cases decimals are present. Decimals do not need change but whole numbers need to change. So for example if the end result is "6" I need it to show it as "6.0" in a field beacuse that is the way the calculator should display it according to request.
      How can I check that the result number is a whole number and then add ".0" to it?
      I just included a simple script below.

      if (outputnumber == ?) {
      resultNum = Number(String(outputnumber+".0"));
      } else {
      resultNum = outputnumber;
      }

      Thanks,
      Attila