DEC2BIN Function (Gnumeric)
Convert decimal integers to binary text in Gnumeric, with zero padding, signed ten-bit results and verified range errors.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
DEC2BIN converts a decimal number to a string of binary digits. The output is text representing a number in base two, not the ordinary decimal number spelled by those digits. For example, “1010” represents decimal ten; adding it as though it were decimal 1010 would answer a different question.
The supported integer range is -512 through 511. Ordinary fractional numeric inputs are truncated toward zero before the range check. For nonnegative inputs, optional places pads with leading zeros, within a maximum of ten digits. Too few places for the representation produces an error. Negative numbers use a ten-bit two’s-complement representation.
Syntax
DEC2BIN(number, [places])
Worked examples
The original =DEC2BIN(10) returns the text 1010. =DEC2BIN(10,8) returns 00001010, showing that leading zeros belong to the representation. In a worksheet, put 10 in A2, 8 in B2 and use =DEC2BIN(A2,B2) in C2.
The boundary controls DEC2BIN(511) and DEC2BIN(-512) return 111111111 and 1000000000. DEC2BIN(-1) returns ten ones, 1111111111. The negative result encodes a signed ten-bit value rather than prefixing a minus sign.
DEC2BIN(10.9) returns 1010 after truncation. For deliberate integer work, validate inputs instead of relying on that coercion. DEC2BIN(-1,1) still returns ten digits; the requested width does not shorten a negative representation.
Advanced use
A small conversion can be verified by positional weights: 1010 means 18+04+12+01=10. For a negative ten-bit result, interpret the leading bit as the sign under the function’s two’s-complement convention. The pattern 1000000000 represents -512, not positive 512.
Keep binary strings in a dedicated text column when exporting or copying data. A consumer that interprets them as ordinary decimal numbers can drop leading zeros or misread their meaning. Use the corresponding binary-to-decimal conversion when arithmetic on the represented value is needed.
Errors and troubleshooting
DEC2BIN(512), DEC2BIN(-513) and DEC2BIN(10,3) return #NUM!. Incompatible text “bad” produces #VALUE!.
Although the help says places is ignored for negative numbers, the implementation still validates the supplied width: DEC2BIN(-1,0) returns #NUM!. Use an omitted width or a valid width from 1 through 10 for the selected negative-number contract. These checks do not make DEC2BIN an arbitrary-width binary encoder. Input parsing of numeric-looking text can depend on formatting conventions and is not generalized here.
Availability and verification
- Introduced: Documented by 1.12.62; original introduction not established.
- Historical source availability: Supported in Gnumeric 1.12.62, based on the function-specific registration.
- Scope: Desktop; the fn-eng function module must be included and enabled.
- Historical check: October 14, 2026. Documentation/source check; no new native test in Gnumeric 1.12.62.
The selected examples and errors were recalculated with the actual Gnumeric 1.12.57 engine under C.UTF-8 on 17 October 2026. Native workbooks and observed outputs are retained. Historical 1.12.62 registration is a separate source check, not a native runtime test. No GUI test or retirement date is established, and the last functioning release remains unverified.