Rexx Tutorial on Rexx Numbers

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.