Skip to main content
Solved

Using the Number Package with Math Operations and Decimals

  • 10 July 2024
  • 2 replies
  • 52 views

I’ve been doing some testing using the number package and math operations. According to the documentation, the number package “ holds values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, and up to 15 decimal digits.” Emphasis mine.

I’ve been trying unsuccessfully to add, subtract, multiply and divide where the result should be a decimal. All I’m getting is whole numbers no matter what I feed in. Examples attached.

How do you get the number package to recognize and return decimals?

 

2 replies

Userlevel 2
Badge +8

Ok so after further investigation it seems that the function $variableName.number:ToString” does not return decimal places. This function only returns digits left of the decimal place.

In order to see a resulting decimal from a math operation you have to use the Number Action “Number: To String” which has a configuration for how many decimal places to include. So, if you are outputting any number that contains a decimal to a log, or file, or spreadsheet etc. you will need to first assign that to a string variable using this action.

Userlevel 5
Badge +9

@JMarino

 

yes, you need add the action to convert to String to show as a message: 

 

 

https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/aae-client/bot-creator/commands/number-to-string.html

 

Regards

Reply