Contact

DEC2OCT Function (Gnumeric)

Engineering Intermediate Gnumeric

Convert decimal values with Gnumeric DEC2OCT: signed range, fractional truncation, padded octal text, negative complements and native examples.

Verification status: 18 reference, boundary and advanced-check formulas were recalculated through Gnumeric 1.12.57 ssconvert with retained native formula identities and ODF results. Independent arithmetic and 1.12.62 source were also checked; 1.12.62 was not executed. How formula examples are checked

Quick answer: =DEC2OCT(42,4) returns 0052 in Gnumeric 1.12.57. The result is text, so leading zeroes are significant for its displayed representation.

Availability and version history

  • Introduced: First release not established.
  • Supported in: Gnumeric 1.12.62, with no retirement established.
  • Scope: Desktop Gnumeric with the Engineering plugin; English comma-separated formulas are used below.
  • Checked: October 14, 2026. The reference and boundary tables plus the explicit roundtrip or recurrence were recalculated through 1.12.57 ssconvert and compared with native formula records, source and independent arithmetic. 1.12.62 is source-checked only.

What DEC2OCT returns

DEC2OCT converts a decimal number into octal text. Decimal 42 becomes 52 because 5×8+2=42. Negative inputs use a ten-digit octal complement rather than a leading minus sign. Versioned function help.

Syntax and arguments

=DEC2OCT(x[,places])

x is required. The implementation truncates a numeric fraction toward zero, then requires the resulting integer to be between −536870912 and 536870911, inclusive. Optional places pads nonnegative output, subject to a maximum of ten digits. Use numeric decimal values when the input is a quantity. Brackets mark optional arguments and are not typed into the formula. Function implementation.

Reproducible examples

Backticks preserve the exact digits and padding; text encodings are not decimal quantities. All eight reference rows below were recalculated in the stated 1.12.57 build.

Formula Gnumeric 1.12.57 result
=DEC2OCT(0) 0
=DEC2OCT(8) 10
=DEC2OCT(42) 52
=DEC2OCT(42,4) 0052
=DEC2OCT(536870911) 3777777777
=DEC2OCT(-1) 7777777777
=DEC2OCT(-536870912) 4000000000
=DEC2OCT(-42,4) 7777777726

Practical worksheet

Suppose a worksheet stores the decimal value 42 in A2 and an external data format requires a four-character octal field. =DEC2OCT(A2,4) returns 0052. Preserve that text field separately from the decimal value so ordinary arithmetic continues to use 42.

A zero-filled output is still text. If a CSV consumer automatically interprets it as a decimal integer, the meaning of both the base and the leading zeroes can be lost.

Advanced checks and interpretation

The executed roundtrip =OCT2DEC(DEC2OCT(-42)) returns −42. The intermediate text is 7777777726, which represents 8^10−42 in the ten-digit complement convention. At the lower boundary, −536870912 is encoded as 4000000000.

The valid negative example =DEC2OCT(-42,4) still returns ten digits. A requested width of four does not shorten or truncate the complement.

Boundaries and troubleshooting

The native case =DEC2OCT(8.9) returns 10 because 8.9 is truncated to decimal 8 before conversion. Do not use that behavior to silently discard measurement precision. Decide whether fractional data is valid before converting an entire column.

A valid width can be ignored for a negative output, but invalid widths still fail: =DEC2OCT(-1,0) and =DEC2OCT(-1,11) both returned #NUM!. Text “64” was accepted as a decimal value; text “abc” was not. Parsing numeric strings can depend on locale, so quoted numbers are not a substitute for validated numeric cells.

In the following tests F5 is an actually empty cell. The empty string "", when present, is an explicit string argument.

Formula Gnumeric 1.12.57 result
=DEC2OCT(536870912) #NUM!
=DEC2OCT(-536870913) #NUM!
=DEC2OCT(8.9) 10
=DEC2OCT("64") 100
=DEC2OCT("abc") #VALUE!
=DEC2OCT(F5) #NUM!
=DEC2OCT(64,1) #NUM!
=DEC2OCT(-1,0) #NUM!
=DEC2OCT(-1,11) #NUM!

Conversion and version limits

The shared conversion helper controls parsing, complement handling and width checks. The individual function entry is unchanged between the inspected 1.12.57 and 1.12.62 sources, but the shared digit-extraction helper changed. These native results therefore establish 1.12.57, not automatic equivalence for every 1.12.62 boundary. A stale SUM cache and an uncached SUM formula both recalculated correctly, with original function identities retained. Other locales, GUI entry and extreme values beyond the listed cases were not tested.