BITAND Function (Gnumeric)
Use Gnumeric BITAND to test shared binary flags, with range examples, fractional inputs and explicit 1.12.57 versus 1.12.62 conversion differences.
Verification status: 20 reference, boundary and advanced-check formulas were recalculated with Gnumeric 1.12.57 ssconvert. Retained native records and independent integer calculations were checked. Version 1.12.62 was source-checked only. How formula examples are checked
Version note: Native examples use Gnumeric 1.12.57. Current 1.12.62 source changes text conversion and the integer bound. See the version-specific section before reusing boundary results.
Quick answer: =BITAND(9,5) gives 1 in the tested Gnumeric 1.12.57 build.
Availability and version history
- Introduced: First release not established; present in the retained 1.12.57 source. Multiple-argument support was added in 1.12.51.
- Supported in: Gnumeric 1.12.62; no retirement is established.
- Scope: Desktop Gnumeric with its Number Theory plugin. English comma-separated formulas are shown.
- Checked: October 14, 2026. Tables and the named advanced check were recalculated with 1.12.57 ssconvert. Current 1.12.62 source was inspected; the later release was not executed.
What BITAND returns
BITAND keeps a bit only when every collected numeric input has that bit set. The result is an integer bit mask, not a logical TRUE/FALSE comparison. For 9 and 5, binary 1001 AND 0101 is 0001, so the result is 1. Versioned function help.
Syntax and arguments
=BITAND(value1[,value2,...])
value1, value2, ... can be numbers or ranges. Additional inputs participate in the same reduction; Gnumeric is not restricted to two values. Nonnegative fractional numbers are floored by the bitwise helper. In the tested 1.12.57 build, text and blanks are ignored and booleans contribute 1 or 0. An empty numeric collection is an error.
Brackets mark additional optional arguments; do not type the brackets. Current implementation.
Reproducible examples
For the range examples, enter numeric 1, 3 and 7 in F2:F4. Leave F5 empty. G2:G3 contain the text strings “3” and “5”, deliberately stored as text. H2:H4 contain TRUE, FALSE and numeric 2. These types were retained in the input and native outputs.
These eight native integer results were independently checked by binary arithmetic or elementary number theory.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=BITAND(9,5) |
1 |
=BITAND(15,10) |
10 |
=BITAND(12,3) |
0 |
=BITAND(0,7) |
0 |
=BITAND(255,15) |
15 |
=BITAND(42,15) |
10 |
=BITAND(1,2,4) |
0 |
=BITAND(F2:F4) |
1 |
Practical worksheet
Suppose flags 1, 4 and 8 denote three independent options. A stored mask of 13 contains all three. =BITAND(13,5) returned 5, confirming that both requested flags 1 and 4 are present. Comparing the result with 5 tests whether all requested bits are present; merely comparing it with zero tests whether at least one is present. These are different questions.
For a worksheet, place a numeric mask in A2 and a numeric requested mask in B2. =BITAND(A2,B2)=B2 is the corresponding all-bits predicate. Validate the inputs first: text ignored by an older version could make an apparently plausible result misleading.
Advanced interpretation and checks
For nonnegative integer masks, AND is associative, commutative and idempotent. Repeating a mask does not change the result. With three inputs 1, 2 and 4, no bit is shared by all three, giving 0. In contrast, the range F2:F4 containing 1, 3 and 7 has the low bit in common, giving 1.
AND can extract a field: =BITAND(42,15) gives 10 because mask 15 keeps the four low bits of binary 101010. It does not shift those bits into a new position. Use a separately checked shift operation when a field begins above the lowest bit.
Version-specific source differences
Version-sensitive conversion: The tables record 1.12.57, which ignores text. Current 1.12.62 source instead requests numeric-string conversion: successfully parsed numbers participate, while failed numeric conversion gives #VALUE!. These newer conversion paths were source-checked, not executed. Older callback; current callback; string collector.
For the standard binary64 build, the older shared input bound is 2^52 = 4503599627370496. The pinned 1.12.62 expression raises it to 2^53 = 9007199254740992. This change is established by comparing the older bound with the current bound; it is not a native test of 1.12.62. Input acceptance and exact representability of every resulting integer are separate questions.
Boundaries and troubleshooting
A zero result is valid when no bits are shared. It must not be confused with the empty-collection #VALUE! result. Negative inputs and inputs above the tested build’s bound also produce #VALUE!. The table deliberately keeps empty, text, boolean and fractional cases separate.
F5 is an actually empty cell. Listed errors are native error results, not mathematical zeroes.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=BITAND() |
#VALUE! |
=BITAND(F5) |
#VALUE! |
=BITAND(-1,1) |
#VALUE! |
=BITAND(9.9,5.9) |
1 |
=BITAND("9",5) |
5 |
=BITAND("abc",1) |
1 |
=BITAND(TRUE(),FALSE()) |
0 |
=BITAND(G2:G3) |
#VALUE! |
=BITAND(H2:H4) |
0 |
=BITAND(9007199254740992,1) |
#VALUE! |
=BITAND(9007199254740994,1) |
#VALUE! |
Official evidence and checking scope
- Current worksheet implementation
- Tested-version worksheet implementation
- Current calculation helper
- Tested-version calculation helper
The retained workbook contained a deliberately stale SUM cache and an uncached SUM formula, both recalculated correctly. Native evidence covers the listed 1.12.57 cases. Other worksheet layouts and mathematical interpretations are separately explained checks. GUI entry, other locales and later-release output were not tested.