OCT2BIN Function (OpenOffice Calc)
Convert octal strings to signed binary in Apache OpenOffice, with ten-bit output boundaries and a tested rejection of oversized negative codes.
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: =OCT2BIN("377") returned 11111111 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 OCT2BIN returns
OCT2BIN reads an octal string and returns binary text. Its source can encode a signed thirty-bit number, but its result must fit the signed ten-bit binary range. Output range checking is essential even for a valid octal code. Release entry.
Syntax and arguments
=OCT2BIN(OctalNumber [; Places])
OctalNumber has at most ten digits from 0 to 7. Exactly ten digits starting with 4–7 decode as negative values. The result must be between −512 and 511 inclusive. Optional Places must convert to 1 through 10 and pads nonnegative binary results.
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 |
|---|---|---|
=OCT2BIN("0") |
0 |
0 |
=OCT2BIN("1") |
1 |
1 |
=OCT2BIN("12") |
1010 |
1010 |
=OCT2BIN("377") |
11111111 |
11111111 |
=OCT2BIN("777") |
111111111 |
111111111 |
=OCT2BIN("7777777777") |
1111111111 |
1111111111 |
=OCT2BIN("7777777000") |
1000000000 |
1000000000 |
=OCT2BIN("52") |
101010 |
101010 |
Practical worksheet
=OCT2BIN("52") returns 101010, since octal 52 is decimal 42. =OCT2BIN("12";8) returns 00001010. A Places value smaller than the necessary positive digits is rejected.
Octal 777 is +511 and fits, while 1000 is +512 and does not. The number of octal characters alone is insufficient to decide whether the binary output can represent the value.
Advanced interpretation and checks
The ten-octal-digit code 7777777777 represents −1 and becomes ten binary ones. 7777777000 represents −512 and becomes 1000000000. These conversions narrow a signed thirty-bit representation to a signed ten-bit representation.
The most negative thirty-bit octal code 4000000000 represents −536870912, far outside the binary output range. Its native diagnostic is retained because another implementation’s anomalous result for this string must not be assumed to apply here.
For nonnegative values within range, map each octal digit to three bits and then apply the desired leading-zero width. For negative values, signed decoding precedes re-encoding.
Boundaries and troubleshooting
A valid source code outside −512 through 511 is an error. Inputs containing 8 are invalid octal; an empty string instead decodes to zero. Negative outputs use ten binary digits, and a valid smaller Places value does not redefine their sign width. Keep exact text results distinct from ordinary decimal arithmetic.
These additional formulas were recalculated through the same import path. Error displays are retained as errors, even when an ODS numeric attribute stores zero.
| Formula | Observed result or error |
|---|---|
=OCT2BIN("12";8) |
00001010 |
=OCT2BIN("777";8) |
Err:502 |
=OCT2BIN("1000") |
Err:502 |
=OCT2BIN("7777776777") |
Err:502 |
=OCT2BIN("4000000000") |
Err:502 |
=OCT2BIN("") |
0 |
=OCT2BIN("8") |
Err:502 |
Other spreadsheet implementations
The OCT2BIN 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
- Function-specific release entry
- Conversion or strict complex parser
- Signed positional decoder
- Width conversion
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.