BITLSHIFT Function (Gnumeric)
Shift binary masks left in Gnumeric, with negative shifts, fractional-count flooring, 64-bit wraparound and explicitly scoped native results.
Verification status: 19 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
Quick answer: =BITLSHIFT(9,5) gives 288 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.
- 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 BITLSHIFT returns
BITLSHIFT moves the binary representation of a nonnegative number left by the requested count. Each ordinary left shift multiplies by two only while no high bits are lost and the result remains representable. A negative shift count reverses direction. Versioned function help.
Syntax and arguments
=BITLSHIFT(value,shift)
Both value and shift are required. A nonnegative fractional value is converted to an unsigned integer after the input-bound check. The shift count is floored, including negative fractions: −0.9 becomes −1, not zero. A blank value is converted to zero in the tested call.
Reproducible examples
These eight native integer results were independently checked by binary arithmetic or elementary number theory.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=BITLSHIFT(9,5) |
288 |
=BITLSHIFT(16,2) |
64 |
=BITLSHIFT(31,1) |
62 |
=BITLSHIFT(5,-1) |
2 |
=BITLSHIFT(5,0) |
5 |
=BITLSHIFT(0,3) |
0 |
=BITLSHIFT(1,10) |
1024 |
=BITLSHIFT(255,4) |
4080 |
Practical worksheet
The number 9 is binary 1001. Shifting left five places produces 100100000, decimal 288: =BITLSHIFT(9,5) gives 288. This can position a validated small field within a wider numeric mask.
If A2 contains a field and B2 its starting bit position, =BITLSHIFT(A2,B2) illustrates the placement. Before combining fields, check that their permitted widths do not overlap and that shifting will not discard high bits. The function does not enforce an application-specific field width.
Advanced interpretation and checks
A right shift can reverse a left shift only if information was not lost. =BITRSHIFT(BITLSHIFT(13,3),3) returned 13 for the ordinary tested case. This is not a guarantee for every input.
The implementation shifts an unsigned 64-bit integer. The native case =BITLSHIFT(4503599627370496,12) returns 0, because 2^52 shifted left twelve places reaches 2^64 and the high bit is discarded. It does not return the mathematical product 2^64 or an overflow error. A returned zero therefore requires context.
Version-specific source differences
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
Shift counts at least 64 or at most −64 explicitly return zero. This is a source branch, not evidence that arbitrary fractional or nonfinite counts are safe. Negative values are #NUM!, malformed text is #VALUE!, and missing the required shift argument is #N/A in the retained native cases. The result uses floating-point storage, so large integer outputs also face representation limits.
F5 is an actually empty cell. Listed errors are native error results, not mathematical zeroes.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=BITLSHIFT(9.9,1) |
18 |
=BITLSHIFT(8,1.9) |
16 |
=BITLSHIFT(8,-0.9) |
4 |
=BITLSHIFT(-1,2) |
#NUM! |
=BITLSHIFT(1,64) |
0 |
=BITLSHIFT(1,-64) |
0 |
=BITLSHIFT(F5,2) |
0 |
=BITLSHIFT("abc",2) |
#VALUE! |
=BITLSHIFT(8) |
#N/A |
=BITLSHIFT(4503599627370496,12) |
0 |
Official evidence and checking scope
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.