Rexx - Numbers


Advertisements

Rexx has the following data types when it comes to numbers.

  • Integer − A string of numerics that does not contain a decimal point or exponent identifier. The first character can be a plus (+) or minus (-) sign. The number that is represented must be between -2147483648 and 2147483647, inclusive.

  • Big Integer − A string of numbers that does not contain a decimal point or an exponent identifier. The first character can be a plus (+) or minus (-) sign. The number that is represented must be between -9223372036854775808 and 2147483648, inclusive, or between 2147483648 and 9223372036854775807.

  • Decimal − One of the following formats −

    • A string of numerics that contains a decimal point but no exponent identifier, where p represents the precision and s represents the scale of the decimal number that the string represents. The first character can be a plus (+) or minus (-) sign.

    • A string of numerics that does not contain a decimal point or an exponent identifier. The first character can be a plus (+) or minus (-) sign. The number that is represented is less than -9223372036854775808 or greater than 9223372036854775807.

  • Float − A string that represents a number in scientific notation. The string consists of a series of numerics followed by an exponent identifier (an E or e followed by an optional plus (+) or minus (-) sign and a series of numerics). The string can begin with a plus (+) or minus (-) sign.

Let’s now look at the different methods available for numbers.

Sr.No. Methods available for Numbers
1 ABS

This method returns the absolute value of an input number.

2 MAX

This method returns the maximum value from a list of numbers.

3 MIN

This method returns the minimum value from a list of numbers.

4 RANDOM

This method returns a random generated number.

5 SIGN

Returns 1 if number is greater than 0, or 0 if the number is 0, or -1 if the number is less than 0.

6 TRUNC

This method truncates a number.

Advertisements