Forum Discussion

lucky_star's avatar
lucky_star
Occasional Contributor
7 years ago

subtraction of two variable

Hi guys,

 

I have an issue of subtraction of two variable with large numbers. Here is my script:

 

function test()
{
  var str1 = "1,000,659,875,073,160";
  var str2 = "1";
  
  str1 = Utilities.FormatFloat(0, str1);
  str2 = Utilities.FormatFloat(0, str2);
  
  Log["Message"](str1);
  Log["Message"](str2);
  
  var res = aqConvert["VarToFloat"](str1) - aqConvert["VarToFloat"](str2);
  Log["Message"](res);
}


And attached screenshots of the result.

Can you please help me?

 

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    hi,

    I bet there is no issue. "E15" is scientific notation for large numbers. E15 means 1*10^15 and means 1 with 15 zéros.

    • lucky_star's avatar
      lucky_star
      Occasional Contributor

      Thank you for your prompt reply, :heart:

       

      Yes, I see it is an scientific notation :) . This is only my issue, not a bug. But I would someone can help me how to format the number from hexadecimal to decimal number.

       

      Could someone help me, please :)

  • SanderK's avatar
    SanderK
    Occasional Contributor

    Scientific notation is still decimal, not hexadecimal. In Javascript there is a Number.toFixed() function which gets rid of the scientific notation. Your scripting language (is that C++ script or C# script?) probably has a similar feature.