Documentation/Calc Functions/DEC2OCT/en

Function name:
DEC2OCT

Category:
Add-in

Summary:
Converts a decimal number (base-10) to its octal (base-8) equivalent. The input decimal number must be in the range -229 ≤ d < 229.

Syntax:
DEC2OCT(Number[; Places])

Returns:
Returns a text string comprising up to 10 octal characters (0…7), which is the octal number in two’s complement form that corresponds to the specified decimal number.

Arguments:
Number is a string or a number, or a reference to a cell containing one of those types, which gives the decimal number that is to be converted to octal. The decimal number should be an integer that is not less than -229 or greater than 229-1.

Places is an integer in the range 1 to 10, or a reference to a cell containing that value, which is the number of characters that should be returned for a positive Number. Places is ignored for negative values of Number, when DEC2OCT always returns 10 characters. The default for positive values of Number is for the returned string to occupy as many characters as necessary to accommodate the octal representation, but you can set the value of Places to add leading zeroes where necessary.


 * If Number is non-numeric (including an empty string), then DEC2OCT reports a #VALUE! error.
 * If Number is a non-integer value, then DEC2OCT truncates it to an integer.
 * If, after any truncation, Number is outside the range specified, DEC2OCT reports an invalid argument error (Err:502).
 * If Number is a reference to an empty cell, DEC2OCT returns 0 (possibly with leading zeroes, depending on the value of Places).
 * If Places is non-numeric, then DEC2OCT reports an invalid argument error (Err:502).
 * If Places is a non-integer value, then DEC2OCT truncates it to an integer.
 * If, after any truncation, Places is less than 1 or greater than 10, DEC2OCT reports an invalid argument error (Err:502).
 * If Number is positive and Places is less than the minimum number of characters required to accommodate the octal representation of Number, then DEC2OCT reports an invalid argument error (Err:502).

Additional details:
The following Wikipedia pages provide useful background information that is relevant to this function:
 * Octal
 * Two's complement

Related LibreOffice functions:
DEC2BIN

DEC2HEX

ODF standard:
Section 6.19.9, part 2

Equivalent Excel functions:
DEC2OCT