Variable Modify Decimal

Use the Variable Set Decimal command to assign a decimal value to a variable. The commands listed below modify or manipulate the original decimal variable.

üNote: A decimal variable (D[1]) can range from 5.0 x 10^ -324 to 1.7 x 10^308 with 15 to 16 significant digits. This first example is a decimal expanded to include 324 leading zeros followed by the number 5, represented as .000(321 more zeros)5. The second range extends to 17 followed by 308 zeros which would look like 1700000000(300 more zeros).0. The numbers are rounded to 15 or 16 significant digits.

Script Editor > Expand Variables Category > Variable Modify Decimal

Add

Add a decimal variable to a number or to a second decimal variable. Save the results to another decimal variable.

Destination Decimal Variable

Select the variable to receive the results of the addition.

Value One /Value Two

Insert either a decimal value or a decimal variable into these fields. The values are added and saved to the variable selected.

Subtract

Subtract a decimal variable from a number or from another decimal variable or subtract a number from a decimal variable. The result is placed in the decimal variable selected.

Decimal Variable

Select the variable to receive the results of the subtraction.

Value One /Value Two

Insert either a decimal value or a decimal variable into these fields. The values are subtracted and saved to the variable selected.

Multiply

Multiply a decimal variable with a number or with another decimal variable and place it in the decimal variable selected.

Decimal Variable

Select the variable to receive the results of the multiplication.

Value One /Value Two

Insert either a decimal value or a decimal variable into these fields. The values are multiplied and saved to the variable selected.

Divide

Divide a decimal variable with a number or with another decimal variable or divide a number with a decimal variable. The result can be placed in the decimal variable chosen.

Decimal Variable

Choose the variable to receive the results of the division.

Value One /Value Two

Insert either a decimal value or a decimal variable into these fields. The values are divided and saved to the variable selected.

Round

This command rounds the value of a decimal variable to the number of decimal places selected. If copying a decimal value and saving it to a variable or modifying a decimal variable through multiplication or division, use this feature to trim the number of decimal places. Just select the variable to round and insert the number of decimal places.

Decimal places to round to

Insert the number of decimal places to save to the variable.

üNote: The Round Decimal Variable command uses asymmetric arithmetic rounding to determine how to round values that are exactly midway between the two values that have the desired number of significant digits. This method always rounds to the larger value.

The following examples illustrate the use of the Rounding command:

For example:

If %D[1]% is 1.234 then Round Decimal Variable %D[1]% to 2 decimal places results in 1.23

If %D[1]% is 1.235 then Round Decimal Variable %D[1]% to 2 decimal places results in 1.24

If %D[1]% is -1.235 then Round Decimal Variable %D[1]% to 2 decimal places results in -1.23

Convert to Text String

Use this command to convert a decimal variable to a text variable. Specify the number of decimal places to use.

Destination String Variable

Select the string variable to receive the decimal variable value.

Decimal Places

Insert the number of decimal places to save to the text string variable.

Truncate to Integer

Use this command to convert a decimal variable to an integer variable. Any fractional part of the decimal value is truncated.

Integer Variable

Select the integer variable to receive the truncated decimal variable value.

Remove Integer Portion

Use this command to remove the integer value portion (whole numbers) from the decimal variable. For example, if the decimal variable has a value of 1.9087653, the new value would be .9087653.

Destination Decimal Variable

Select the decimal variable to receive the value with the integer portion removed.

Copy Value

Copy the value of one decimal variable to another decimal variable.

Destination Decimal Variable

Select the decimal variable to receive the value of the copied decimal variable.