ATAN2(0,0): #DIV/0! in Excel and Google Sheets, but 0 in LibreOffice (executed)
ATAN2 returns the angle, in radians, of the point (x, y) measured from the
positive x-axis — the two-argument arctangent that gets the quadrant right where plain
ATAN(y/x) cannot. Every engine agrees on the ordinary cases. They disagree on the one point
that has no angle at all: the origin. Excel documents that =ATAN2(0,0) returns
#DIV/0!, and Google Sheets does exactly that. LibreOffice Calc returns
0 instead — a real number, no error.
The surprise
This is a silent divergence: no error, no #NAME?, just a different
number. A formula that leans on ATAN2(0,0) raising #DIV/0! to flag a
degenerate “no direction” case keeps erroring in Excel and Google Sheets and quietly
produces an angle of 0 in LibreOffice — and anything downstream (a bearing, a
rotation, a DEGREES conversion) inherits that 0 without warning.
A minimal example
| Formula | Excel, desktop (documented) | Google Sheets (executed 2026-08-29) | LibreOffice Calc 25.8.7.3 (executed) |
|---|---|---|---|
| =ATAN2(0,0) | #DIV/0! | #DIV/0! | 0 |
| =ROUND(ATAN2(1,1),9) | 0.785398163 | 0.785398163 | 0.785398163 |
| =ROUND(ATAN2(0,1),9) | 1.570796327 | 1.570796327 | 1.570796327 |
Only the origin diverges. Every non-degenerate point — ATAN2(1,1) is
π/4, ATAN2(0,1) is π/2 — matches to full precision in
all three engines, and the 0 LibreOffice returns for ATAN2(0,0) is identical
across all four releases we test (24.2, 24.8, 25.2 and 25.8), so it is a deliberate convention, not a
version bug. Microsoft’s page is explicit: “If both x_num and y_num are 0, ATAN2 returns the
#DIV/0! error value” — and Google Sheets, executed the same way (Drive import,
2026-08-29), matches Excel here.
Why it happens
The origin genuinely has no defined direction, so each engine picks a convention. Excel (and Google
Sheets, following it) treat the undefined case as an error and raise #DIV/0!. LibreOffice
follows the common programming convention that atan2(0, 0) = 0 — the same value C,
Python and most math libraries return — and hands back a number. Neither is wrong; they are two
defensible answers to “what is the angle of a point that has no angle,” and a workbook that
moves between the apps meets both.
How to migrate safely
Do not rely on ATAN2(0,0) erroring — it errors in Excel and Google Sheets and does
not in LibreOffice. If the origin is a real possibility in your data, handle it explicitly so every
engine agrees:
=IF(AND(A1=0,B1=0),"undefined",ATAN2(A1,B1)) gives the same result everywhere.
If instead you want the programming-style 0 for the origin, wrap the Excel/Sheets
error: =IFERROR(ATAN2(A1,B1),0) returns 0 at the origin in all three apps and
the true angle elsewhere. Either way, make the origin’s value a choice in the formula rather than
something that depends on which application opened the file — and after migrating, look for
ATAN2 over coordinates that can both be zero, since that single cell can flip between an
error and 0 with no other visible change.
Check before you migrate
A note on which Excel this is. The Excel column in the tables above is Microsoft’s documented behaviour for desktop Excel, as recorded in our test corpus — we do not run desktop Excel, and no value in that column is a measurement. Excel for the web is a different application with its own calculation engine, and that one we do run (recalculated on OneDrive, 2026-09-01); it returns #DIV/0! for ATAN2(0,0), the same as documented desktop Excel and Google Sheets, and unlike LibreOffice. Its measured results are published on each function’s own page rather than in these guide tables. Because we have no desktop run to compare against, a disagreement between an Excel-web measurement and the documented column is genuinely ambiguous: it may mean the web engine diverges from the desktop one, or that the documentation is wrong about both. We do not claim to know which.