OCT2DEC Function (OpenOffice Calc)
Decode octal text to decimal in Apache OpenOffice, with ten-digit signed interpretation, empty-input behavior and numeric results.
Verification status: Eight reference formulas and 7 diagnostic cases were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, using XLSX import and GUI hard recalculation. Saved formula identities and typed results were checked. How formula examples are checked
Quick answer: =OCT2DEC("377") returned 255 in the tested Apache OpenOffice 4.1.16 build.
Availability and version history
- Introduced: First release not established; documented by OpenOffice.org 3.3.
- Supported in: Apache OpenOffice 4.1.16; this identifies a verified release, not a final supported version.
- Scope: Desktop Calc with its Analysis add-in, English function names and semicolon-separated formulas.
- Checked: October 14, 2026. Eight reference formulas and the listed diagnostics were recalculated after XLSX import in 4.1.16 on Linux x86-64, Build 9816. Source and independent reference calculations were also checked.
What OCT2DEC returns
OCT2DEC returns a numeric decimal value from an octal string. Unlike the text-returning conversion functions, its result can be used directly in ordinary numeric arithmetic. It decodes a fixed signed thirty-bit convention for ten-digit inputs. Release entry.
Syntax and arguments
=OCT2DEC(OctalNumber)
Exactly one octal argument is required, containing at most ten digits from 0 to 7. A shorter string is nonnegative. An exactly ten-digit string whose first digit is 4–7 is interpreted as negative. No Places argument is accepted because the output is numeric rather than padded text.
Reproducible examples
The native column records the saved 4.1.16 results. Text-returning conversion strings are retained exactly, including leading zeroes and uppercase hexadecimal letters. OCT2DEC, IMREAL and IMAGINARY return numeric values. These integer and quarter-unit references agree exactly with the saved results; errors are checked by display rather than interpreted from a numeric zero cache.
| Formula | Native 4.1.16 result | Independent reference |
|---|---|---|
=OCT2DEC("0") |
0 |
0 |
=OCT2DEC("1") |
1 |
1 |
=OCT2DEC("12") |
10 |
10 |
=OCT2DEC("377") |
255 |
255 |
=OCT2DEC("3777777777") |
536870911 |
536870911 |
=OCT2DEC("4000000000") |
-536870912 |
-536870912 |
=OCT2DEC("7777777777") |
-1 |
-1 |
=OCT2DEC("52") |
42 |
42 |
Practical worksheet
=OCT2DEC("52") returns 42, from 5×8+2. =OCT2DEC("377") returns 255. A leading-zero form such as 0000000001 still represents +1 because its first digit does not set the signed convention.
The maximum positive code 3777777777 returns 536870911. 4000000000 returns −536870912, while 7777777777 returns −1. These are signed interpretations, not unsigned integers silently overflowing.
Advanced interpretation and checks
For ordinary digits dₖ…d₀, form the positional value Σdⱼ8ʲ. If the input has exactly ten digits and begins with 4–7, subtract 8^10=2^30. This gives the documented negative interpretation directly.
The exact digit count matters: fewer than ten octal digits cannot set that sign convention. Extra leading zeroes beyond the ten-character maximum are rejected even if the mathematical unsigned value would remain small.
The decoded range lies well within exact integer representation in ordinary binary64 arithmetic, so these integer reference values can be checked exactly. That does not extend to arbitrary-length octal codes, which this function rejects.
Boundaries and troubleshooting
Empty strings and the tested blank reference become numeric zero. An explicit minus sign is not accepted; negative values use the ten-digit code. Illegal digit 8, excessive length and an extra argument are distinct errors in the diagnostics. Check source completeness before treating the valid zero result as evidence that a code was supplied.
These additional formulas were recalculated through the same import path. H5 is a deliberately empty cell where referenced. Error displays are retained as errors, even when an ODS numeric attribute stores zero.
| Formula | Observed result or error |
|---|---|
=OCT2DEC("0000000001") |
1 |
=OCT2DEC("") |
0 |
=OCT2DEC("8") |
Err:502 |
=OCT2DEC("-1") |
Err:502 |
=OCT2DEC("00000000000") |
Err:502 |
=OCT2DEC(H5) |
0 |
=OCT2DEC("1";2) |
Err:504 |
Other spreadsheet implementations
The OCT2DEC guide for Gnumeric documents that product’s own syntax and tested behavior. A shared function name does not guarantee the same argument conversion, text parsing, branch or precision rules.
Official evidence and checking scope
The saved ODS retained every tested formula identity. A deliberately stale SUM cache changed from 999999 to 3, and an uncached SUM returned 7 after hard recalculation. Native evidence covers the eight reference formulas and listed diagnostics only. Other explanatory compositions are independent mathematical checks; other releases, locales and extreme-value behavior were not established by this run.