Contact

IMLOG2 Function (LibreOffice Calc)

Engineering Intermediate LibreOffice Calc

Learn the IMLOG2 function in LibreOffice Calc: Returns the base-2 logarithm of a complex number.

Verification status: Selected examples were executed in LibreOffice Calc 25.2.3.2. This does not establish that every formula and edge case was tested. How formula examples are checked

Quick answer

IMLOG2 calculates the base-2 complex logarithm, not the number of binary digits. =IMLOG2("3+4i") returns approximately 2.32192809488736+1.33780421245098i. For a positive real input, the displayed result looks numeric, but Calc returns complex-number text.

Function syntax and argument definition

=IMLOG2("ComplexNumber")

ComplexNumber (required): text of the form a+bi or a+bj, a cell containing that representation, a COMPLEX expression, or a real numeric value. This function uses one required argument and returns a text representation of the complex logarithm.

Version and locale: The displayed current English online documentation says LibreOffice 26.8 Help. All native examples below were executed in desktop LibreOffice Calc 25.2.3.2, not the documented 26.8 runtime. English Calc formula examples separate different function arguments with a semicolon (;); complex-number coefficients within one quoted string are not separate arguments. Actual separators and decimal marks can follow your locale. The documented IMCOSH/IMSINH entries specifically say the functions are available since LibreOffice 3.6; other two functions are confirmed in the Help and tested in 25.2 but no undocumented first-version claim is made.

How it works

The principal complex logarithm is log₂(z) = (ln(|z|)+i arg(z))/ln(2). For 3+4i, the magnitude is 5 and angle atan2(4,3) ≈ 0.927295218; therefore the real coefficient is ln(5)/ln(2) ≈ 2.321928095 and the imaginary coefficient is 0.927295218/ln(2) ≈ 1.337804212. Complex logarithms have multiple mathematical branches; this worksheet operation uses the principal branch. The logarithm of zero is undefined.

Reproducible worksheet setup

Place 3+4i in A2, and put 3 and 4 in B2 and C2, respectively. Native =IMLOG2(A2) and =IMLOG2(COMPLEX(B2;C2)) produced the same complex text 2.32192809488736+1.33780421245098i.

To recreate the result, enter the indicated literal complex values as cell text (without a leading equals sign), insert the formula into a different empty cell, and allow Calc to recalculate. Values listed below reflect the actual observed Calc results rather than screenshots or hypothetical applications.

Worked formulas and observed results

On a narrow screen, scroll this table sideways to see every column.

Formula Observed result in Calc 25.2.3.2 Explanation
=IMLOG2("1+j") 0.5+1.1330900354568j LibreOffice documented example.
=IMLOG2("3+4i") 2.32192809488736+1.33780421245098i Positive real and imaginary parts.
=IMLOG2(4) 2 (text) Purely real input; imaginary part zero.
=IMLOG2(8) 3 (text) Powers of two have integer real logarithms.
=IMREAL(IMLOG2("3+4i")) 2.32192809488736 Extract a numeric coefficient.

Advanced example and interpretation

To use the real part in further numerical analysis, calculate =IMREAL(IMLOG2(A2)). To extract the angle-derived imaginary coefficient, enter =IMAGINARY(IMLOG2("1+i")); the native result was 1.1330900354568. For real values without complex arithmetic, the ordinary numeric expression =LN(8)/LN(2) is an independently verifiable alternative and should yield 3 (this alternative was not included in the native test).

Errors, edge cases and limitations

=IMLOG2(0) and =IMLOG2("oops") both produced Err:502 in the native test. Zero has no complex logarithm; malformed strings are not parsed as complex numbers. Do not casually replace these errors with numeric zero.

Type and precision: An ordinary LOG(number;2) is for real-number arithmetic and is not interchangeable for non-real complex inputs. Floating-point computations should generally be checked by numeric tolerance rather than string exact-match. ODF/Excel/Sheets file-format round-trips can affect syntax, prefixes or formatting; export/import behaviour was not tested here.

Troubleshooting

Formula looks correct but SUM ignores the result? IMLOG2 returns a string: =ISTEXT(IMLOG2(4)) returned TRUE in Calc even though the cell displays 2. Use IMREAL or IMAGINARY to obtain numeric coefficients. Strange angle/sign? You are using the principal complex logarithm, not the real-only LOG function. Wrong suffix? Keep the input i or j notation consistent; COMPLEX can produce valid values. Locale trouble? See the separator and decimal notes below.

If you cannot reproduce the result, first confirm the exact formula in the formula bar, check the cell’s source value, inspect decimal and list separators for your locale, and compare the software version. Use simple examples before adding other nested formulas.

Cross-software compatibility

Excel and Google Sheets document IMLOG2 with similar mathematics and complex text conventions. Excel function syntax typically uses comma delimiters in an English locale whereas Calc examples here use semicolons for multi-argument nested functions. Do not assume error strings or automatic conversion from complex-number text are identical. See official cross-software references below; no native Excel or Google Sheets tests were performed.

Official evidence, check date, and test provenance

  • LibreOffice official function page: Documentation for IMLOG2 — accessed 2026-10-11, current display LibreOffice 26.8 Help. Supports named function, purpose, syntax, argument form, and its documented examples.
  • LibreOffice official analysis-functions list: Add-in Functions, Part Two — accessed 2026-10-11. Explains COMPLEX, IMARGUMENT, IMLOG2 and related engineering functions.
  • Microsoft: Engineering functions reference — consulted 2026-10-11 for equivalent Excel function availability; no Excel execution claimed.
  • Google: Sheets function list — consulted 2026-10-11 for function availability; no Sheets execution claimed.
  • Native evidence: The accompanying native_calc_results.json and native_calc_test.py record observed Calc output, numeric/error types and independent Python math comparisons. 34/34 assertions passed across this four-page batch and 8 additional error observations were recorded; not every explanatory derivative formula was executed.

How this guide was checked

Selected example formulas were run in LibreOffice Calc 25.2.3.2 on Linux on October 12, 2026. The official Help may cover a newer version. Tests of selected formulas do not certify every locale, interactive array operation or file round trip. View the example-check record.

Official IMLOG2 reference · Editorial standards