Contact

OCT2HEX Function (Gnumeric)

Engineering Intermediate Gnumeric

Use Gnumeric OCT2HEX for octal-to-hexadecimal text conversion, with padded examples, signed complements, exact roundtrips and native input checks.

Verification status: 17 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: =OCT2HEX("715",4) returns 01CD 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 OCT2HEX returns

OCT2HEX converts octal digits into uppercase hexadecimal text. Octal 715 is decimal 461 and hexadecimal 1CD. The function translates a representation; it does not treat the source string as a decimal quantity. Versioned function help.

Syntax and arguments

=OCT2HEX(x[,places])

x is required. Supply quoted octal text to preserve its original digits and width. Optional places requests a padded hexadecimal width for nonnegative output, with a maximum of ten. A width smaller than the necessary digit count raises #NUM!. 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
=OCT2HEX("0") 0
=OCT2HEX("17") F
=OCT2HEX("377") FF
=OCT2HEX("715",4) 01CD
=OCT2HEX("1000") 200
=OCT2HEX("3777777777") 1FFFFFFF
=OCT2HEX("4000000000") FFE0000000
=OCT2HEX("7777777777") FFFFFFFFFF

Practical worksheet

To generate a four-character hexadecimal field from octal text 715 in A2, use =OCT2HEX(A2,4). The result is 01CD. Retain the original octal column so another reader can trace which source representation was converted.

Padding is an output convention. The leading zero in 01CD does not change the value and should not be mistaken for evidence that the input was a particular signed machine word.

Advanced checks and interpretation

The executed check =HEX2OCT(OCT2HEX("715"),4) returns 0715. This establishes a small positive roundtrip with an explicitly restored four-character octal width. The destination function’s separate range rules still matter for other values.

For signed values, OCT2HEX translates the complement width: octal 4000000000 represents −536870912 and becomes hexadecimal FFE0000000; octal 7777777777 represents −1 and becomes FFFFFFFFFF. Do not read either returned string as a positive decimal number.

Boundaries and troubleshooting

A successful encoding does not guarantee that the reverse function accepts the same negative representation. In this tested Gnumeric release, HEX2OCT’s quoted string FFFFFFFFFF fails its separate input guard. Keep the signed integer and both functions’ accepted ranges explicit instead of relying on an unchecked roundtrip.

The empty-string and empty-cell cases also differ. Spaces, a minus sign and the digit 8 are invalid octal input in the listed examples. A fractional places value is truncated after the width checks; use a positive integer width in ordinary worksheets.

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
=OCT2HEX("8") #NUM!
=OCT2HEX("-1") #NUM!
=OCT2HEX(" 17 ") #NUM!
=OCT2HEX("") 0
=OCT2HEX(F5) #NUM!
=OCT2HEX("777",1) #NUM!
=OCT2HEX("777",11) #NUM!
=OCT2HEX("17",3.9) 00F

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.