$Binary: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
m (Mlarocca moved page $BINARY to $Binary: Lower case change)
(No difference)

Revision as of 13:15, 8 July 2014

The $BINARY function converts the character string representation of a number into its equivalent fixed-point binary representation.

Syntax

The format of the $BINARY function is:

$BINARY (string [, precision [, scale]])

where:

  • string is the character string to be converted.
  • precision (optional) indicates the number of binary digits (bits) desired in the result of the function. Precision must be between 1 and 31, although the most meaningful values are 15 and 31. If the precision argument is greater than 15, a default value of 31 is used. If the precision argument is omitted, a default value of 15 (halfword) is used.
  • scale (optional) indicates the number of fractional binary digits assumed in the result of the function. If the scale argument is omitted, a default value of 0 (integer) is used.

$BINARY returns a value of binary -1 if the string argument does not represent a valid number, if an invalid precision or scale value is specified, or if an overflow occurs.