Math and trigonometry functions

ATAN

Matches all 181,412 recorded answers

Recorded: 181,409 in the answer bank and 3 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicATAN
BulgarianATAN
CzechATAN
DanishARCTAN
GermanARCTAN
GreekATAN
English (Australia)ATAN
English (United Kingdom)ATAN
English (United States)ATAN
SpanishATAN
EstonianATAN
FinnishATAN
FrenchATAN
HebrewATAN
CroatianATAN
HungarianARCTAN
IndonesianATAN
ItalianARCTAN
JapaneseATAN
KoreanATAN
LithuanianATAN
LatvianATAN
NorwegianATAN
DutchBOOGTAN
PolishATAN
Portuguese (Brazil)ATAN
Portuguese (Portugal)ATAN
RomanianATAN
RussianATAN
SlovakATAN
SlovenianATAN
Serbian (Latin)ATAN
SwedishATAN
ThaiATAN
TurkishATAN
UkrainianATAN
VietnameseATAN
Chinese (Simplified)ATAN
Chinese (Hong Kong)ATAN
Chinese (Traditional)ATAN

Names from Microsoft's support site.

What it does

ATAN(number)

ATAN(number) is the principal inverse tangent: the angle in radians whose tangent is number.

atan: R -> (-pi/2, pi/2),    tan(atan x) = x
  • Domain: all real numbers. tan maps each open interval (k*pi - pi/2, k*pi + pi/2) onto the whole real line, so the inverse needs a branch choice but no domain restriction.
  • Range: the open interval (-pi/2, pi/2). The endpoints are approached and never attained; atan(x) -> ±pi/2 only in the limit.
  • Parity: odd, exactly. atan(-x) = -atan(x).
  • Monotonicity: strictly increasing on the whole line, and bounded — one of the few elementary functions that is both.
  • Derivative: d/dx atan x = 1/(1 + x^2). Bounded by 1, never zero, smooth everywhere. ATAN has no singularities, no poles, no branch points on the real line, and no domain edge. It is the best-conditioned of the inverse circular functions and that is why it is the one everything else is built from.
  • Series about zero: atan x = x - x^3/3 + x^5/5 - x^7/7 + ... for |x| <= 1 (the Gregory series). It converges glacially near |x| = 1 — at x = 1 it is the Leibniz series for pi/4, famous for needing hundreds of terms per digit — which is why no implementation uses it without reduction.
  • Asymptotics: atan x = pi/2 - 1/x + 1/(3x^3) - ... for large positive x.
  • Key identities:
    • atan(x) + atan(1/x) = pi/2 for x > 0, and -pi/2 for x < 0. This is the reciprocal reduction, and it is what makes large arguments cheap.
    • The addition formula atan(u) + atan(v) = atan((u+v)/(1-uv)) modulo pi, which is the basis of every classical range reduction and of the Machin-like formulas for pi.
    • atan(x) = asin(x / sqrt(1 + x^2)).
  • Complex continuation: branch cuts along the imaginary axis outside [-i, i] — nothing on the real line is cut, which is the exact statement of the unrestricted real domain.

Abramowitz & Stegun cover the arctangent in chapter 4 section 4.4, including the addition formula and the continued fraction.

Arguments

ArgumentMeaningDefault
numberThe tangent of the angle you want. Required.—

The quoted one-line description is Microsoft's text, from its support article https://support.microsoft.com/en-us/office/atan-function-50746fa8-630a-406b-81d0-4a2aed395543.

The misunderstood point is the quadrant. ATAN cannot tell you which quadrant a point is in, because it receives only a ratio: ATAN(y/x) gives the same answer for (1, 1) and (-1, -1). That is what ATAN2 is for, and it is the single most common reason ATAN is the wrong function.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

Result and edge cases

Returns Number — an angle in radians, strictly between -pi/2 and pi/2.

  • Zero returns zero; an odd implementation preserves the sign of zero.
  • Subnormals and very small arguments pass through unchanged, since atan x = x to within rounding there.
  • ATAN(1) is pi/4 and ATAN(-1) is -pi/4; these are the reduction anchors and are worth checking in any implementation.
  • Very large arguments approach pi/2. Because the range is open, no argument should return exactly the double nearest pi/2... except that, in binary64, the correctly rounded value of atan(x) is that double for all sufficiently large x. The mathematical openness of the range and the representable range therefore disagree: the function saturates. That is not a defect, it is what rounding to a finite grid means, but it is worth stating because it is what makes ACOT built as pi/2 - ATAN(x) fail — see the ACOT page.
  • The largest finite double returns the double nearest pi/2.
  • Arrays lift elementwise.

Errors

ErrorConditionSource
#VALUE!The argument does not convert to a numberShared coercion rules
propagatedAn error value in the argument is returned unchangedShared coercion rules

There is no domain error and no overflow error. ATAN is one of the very few surfaces in this category whose only failures are conversion failures — which is a consequence of a bounded range over an unrestricted domain.

How to implement

Numerical notes

ATAN is the easy one, and the reason is structural: the derivative is bounded by 1, so the function never amplifies an input error, and the range is bounded, so the answer is never so small that relative accuracy becomes precarious — except near zero, where the function is the identity and therefore trivially accurate. There is no cancellation anywhere and no overflow anywhere.

The whole implementation problem is approximation efficiency, not stability.

The Gregory series is unusable directly. Its convergence rate is governed by |x|, and at |x| = 1 it needs a prohibitive number of terms. So every implementation reduces first.

The two reductions, both from the identities above:

  1. Reciprocal reduction, for |x| > 1: atan(x) = sign(x) * pi/2 - atan(1/x). This maps the whole outer half of the domain onto [-1, 1]. The subtraction here is safe because the answer is near ±pi/2, not near zero — the exact opposite of the ACOT situation.
  2. Addition-formula reduction, for the remaining [0, 1]: split at tan(pi/12) = 2 - sqrt(3) and tan(pi/6), and for arguments above the split use atan(x) = pi/6 + atan((x*sqrt(3) - 1)/(x + sqrt(3))) or its pi/4 analogue. Each application shrinks the working interval, so a short polynomial suffices. Cody & Waite give the classical four-interval version; fdlibm's s_atan.c is the published implementation.

The split-constant technique. The reductions add pi/2, pi/4 or pi/6 at the end. Each of those is irrational and its double approximation carries an error of about 2^-53 relative — which is comparable to the final rounding of the answer and would therefore dominate the error budget. The standard fix is to store the constant as an exact-plus-tail pair, c = c_hi + c_lo, with c_hi having trailing zero bits so that additions involving it are exact, and to add c_lo last. This is the same device that makes trigonometric argument reduction work, and it is the reason implementations of ATAN contain two constants where the mathematics has one.

Where implementations differ. Since there is no instability, differences between implementations of ATAN are last-bit differences arising from the polynomial coefficients, the placement of the interval boundaries, and whether intermediate arithmetic happened in extended precision. Those are exactly the kinds of difference that identification work in this Handbook's upstream record has found elsewhere in the elementary set, and they are invisible to any test that compares to fewer than about sixteen digits.

Symmetry. atan is odd, so an implementation should fold the sign and get exact antisymmetry. ATAN(x) + ATAN(-x) being exactly zero is a cheap and complete test of that.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

ATAN · 3 lines · calc-func/src/catalogue/math.rs on GitHub
7 atan "ATAN" (1, 1) [V "number"] |s, a, sv| {
    raw(s, a, ExcelRealPolicy::PASS, k::atan::atan_kernel)
}
atan_kernel · 3 lines · calc-func/src/ported/atan.rs on GitHub
pub fn atan_kernel(n: f64) -> f64 {
    crate::ported::excel_numeric::excel_atan_reduced(n)
}

Kernels shared with other functions

Argument and result plumbing

  • num catalogue/kit
  • out catalogue/kit

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
19929Windows, bitness not recorded, CPU not recorded43
20430Windows, 64-bit, CPU not recorded181,409
  • XC-ATAN-001: build 19929 versus build 20430; 2 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.

Agreement on these compared inputs does not establish agreement on unmeasured inputs.

Recorded environments and comparison details.

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

43 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

181,409 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

Relationships

  • ATAN2 — the four-quadrant version, and the one you usually want. Note Excel's unusual argument order: ATAN2(x_num, y_num) takes x first, the reverse of the C convention. See that page.
  • TAN — the forward function. TAN(ATAN(x)) = x to rounding for every x; ATAN(TAN(t)) folds t into (-pi/2, pi/2).
  • ACOT — ACOT(x) = PI()/2 - ATAN(x) on Excel's documented continuous branch. That identity is exact mathematics and a numerically poor program for large x; the ACOT page is where that is worked out.
  • ASIN and ACOS — both expressible through ATAN, and both harder, because they carry a domain restriction and an endpoint singularity that ATAN does not.
  • ATANH — the hyperbolic namesake, and structurally the opposite: bounded domain (-1, 1), unbounded range, poles at the ends. ATAN is bounded in range and unbounded in domain. The pair is a good illustration that a hyperbolic namesake inverts the geometry.
  • DEGREES — the usual consumer of the result.
  • PI — the reduction constants, and the reason a two-part split constant appears in the numerical notes.
  • Confused with: 1/TAN(x), which is COT; and with ATAN2, when the quadrant matters.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents