BIN2OCT

Syntax:

BIN2OCT ( number [ , num-oct-digits ] )

Description: Makes the octal equivalent of number, with the result having num-oct-digits digits.

Arguments:

Name

Type

Description

number

number

A 10-digit binary number that is to be converted to an octal string. If number has less than 10 digits, leading zero digits are implied until it has exactly 10 digits. The 10 digits use twos-complement representation with the left-most bit (10th bit from the right) representing the sign bit.

num-oct-digits

number

num-oct-digits is the number of digits in the result, with leading zeros added as necessary. However, if number is negative, num-oct-digits is ignored and the result has 10 digits. If num-oct-digits is omitted, the minimum number of digits is used in the result. num-oct-digits is truncated to an integer.

Return Type and Value: text – The octal equivalent of number.

However, if

  • number contains one or more non-binary digits, #NUM! is returned.

  • number contains more than 10 binary digits; that is, number is outside the range 1000000000 (1000 octal, -512 decimal) to 0111111111 (0777 octal, 511 decimal), inclusive, #NUM! is returned.

  • number needs more digits that num-oct-digits, #NUM! is returned.

  • num-oct-digits < 0 or > 10, #NUM! is returned.

example: