Excel 16.0 build 19929
Windows, bitness not recorded, CPU not recorded
31 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.
Math and trigonometry functions
Matches all 2,133 recorded answers
Recorded: 2,130 in the answer bank and 3 workbook cells. How we measure this · See the Rust code
| Language | Name in Excel |
|---|---|
| Arabic | COT |
| Bulgarian | COT |
| Czech | COT |
| Danish | COT |
| German | COT |
| Greek | COT |
| English (Australia) | COT |
| English (United Kingdom) | COT |
| English (United States) | COT |
| Spanish | COT |
| Estonian | COT |
| Finnish | COT |
| French | COT |
| Hebrew | COT |
| Croatian | COT |
| Hungarian | COT |
| Indonesian | COT |
| Italian | COT |
| Japanese | COT |
| Korean | COT |
| Lithuanian | COT |
| Latvian | COT |
| Norwegian | COT |
| Dutch | COT |
| Polish | COT |
| Portuguese (Brazil) | COT |
| Portuguese (Portugal) | COT |
| Romanian | COT |
| Russian | COT |
| Slovak | COT |
| Slovenian | COT |
| Serbian (Latin) | COT |
| Swedish | COT |
| Thai | COT |
| Turkish | COT |
| Ukrainian | COT |
| Vietnamese | COT |
| Chinese (Simplified) | COT |
| Chinese (Hong Kong) | COT |
| Chinese (Traditional) | COT |
Names from Microsoft's support site.
COT(number)
COT(number) returns the cotangent of an angle in radians. Microsoft's page describes it as
the cotangent of an angle specified in radians.
cot x = cos x / sin x = 1 / tan x = tan(π/2 - x)
| Property | Statement |
|---|---|
| Domain | all real x except x = kπ, k ∈ ℤ |
| Range | all of ℝ; every real value is attained once per period |
| Parity | odd: cot(-x) = -cot(x) |
| Period | π — half the period of sin and cos |
| Poles | simple, at x = kπ, each with residue 1 |
| Zeros | x = π/2 + kπ |
| Laurent series at 0 | cot x = 1/x - x/3 - x³/45 - 2x⁵/945 - … (A&S 4.3.70) |
| Derivative | d/dx cot x = -csc²x = -(1 + cot²x) |
| Monotone | strictly decreasing on each interval (kπ, (k+1)π) |
The pole structure is where the reading and the implementation part company. Mathematically
there is a pole at every integer multiple of π. In binary64 only one of those poles is
representable: x = 0. Every other kπ is irrational, so no double sits on it, and near
those poles COT returns a large finite number rather than an error. Microsoft documents
COT(0) as #DIV/0! and documents nothing about the others, which is consistent: 0 is the
only argument at which the division is exactly by zero.
The consequence for a reader is worth stating plainly. COT(PI()) is not an error and is not
infinite; it is roughly the reciprocal of the distance between the double PI() and the true
π, which is a large number whose value says more about the rounding of PI() than about the
cotangent.
| Argument | Meaning | Constraint (as documented) |
|---|---|---|
number | The angle in radians. Required. | ABS(number) < 2^27 |
Microsoft states the magnitude constraint on this page and states #NUM! when it is exceeded.
The bound is 2^27 ≈ 1.342 × 10^8, and it is not arbitrary: it is approximately where a
reduction against a limited-precision π stops producing a reduced argument with any correct
bits. Documenting the bound rather than returning noise is, from a numerical-analysis point of
view, the right call, and it is a choice the older surfaces (COS, SIN, TAN)
do not make on their own documentation pages.
Returns Number.
COT(0) — #DIV/0!, documented explicitly.1/ulp(kπ), so it grows with k.cot changes sign across every pole, so two adjacent doubles either
side of kπ give large values of opposite sign. Any formula that uses COT near a multiple
of π is sitting on a discontinuity of magnitude ~2/ulp.π/2 + kπ, again not representable, so COT of a double is essentially never
exactly zero.2^27 — documented #NUM!.cot x → 1/x, so COT of a tiny argument is a huge finite number and
overflows only for |x| below about 5.6 × 10^-309, i.e. in the subnormal range.As documented on Microsoft's COT page:
| Error | Condition |
|---|---|
#DIV/0! | number is 0 |
#NUM! | ABS(number) is not less than 2^27 |
#VALUE! | number is non-numeric |
COT is the only member of its trio whose page states the zero case. CSC's page
defines CSC(n) as 1/SIN(n) — which makes CSC(0) a division by zero — but does not state
the resulting error; SEC has no zero-pole at all. That asymmetry is in Microsoft's
documentation, not in the mathematics.
Cotangent inherits every difficulty of the tangent and adds one of its own.
The reduction problem, inherited. As on COS, evaluating a circular function
at a large argument requires reducing modulo π/2 against a sufficiently precise π. COT's
documented 2^27 bound is a declaration of exactly where the implementation's reduction gives
up. EV-MATH-0004 identifies the substrate as the x87 FSIN/FPTAN chain with
FPREM1 reduction against the 64-bit ROM π, with the reciprocal surfaces formed from the
published primaries, and it rules out Cody–Waite reduction against extended π. All six
circular surfaces in that record inherit a host-CPU microcode caveat, so the last bits here are
platform-scoped by construction. The record's figures render in the evidence layer beside this
page.
The conditioning problem, its own. The relative condition number of cot is
|x / (sin x cos x)| · |cos x / sin x|^{-1}… stated more usefully: near a pole kπ,
cot x ≈ 1/(x - kπ), so a relative error ε in the reduced argument becomes a relative
error of about ε · |x| / |x - kπ| in the result. Close to a pole this amplification is
unbounded. This is not a fixable defect; it is the function. It does mean that "how accurate is
COT?" has no single answer — accuracy has to be quoted as a function of distance to the
nearest pole.
The double-rounding problem, structural. Building COT as 1/TAN(x) where TAN(x) is the
published binary64 tangent means the tangent's own rounding error is inverted along with the
value. The result is a correctly-rounded reciprocal of an incorrectly-rounded tangent — which
is a different function from a correctly-rounded cotangent, and differs from it by up to about
one ulp more than the tangent already did. A natural-best implementation would instead
evaluate cos r / sin r from a single reduction, sharing the reduced argument between
numerator and denominator so the pole locations agree exactly.
Near zero. For small |x|, 1/TAN(x) is fine — tan x → x with no cancellation — but the
Laurent form 1/x - x/3 - x³/45 (A&S 4.3.70) is cheaper and more accurate, and it is the
standard choice below about 2^-13.
Muller's treatment is the reference for why the tangent family is the hardest of the circular set to round correctly: the worst cases require more extra precision than sine or cosine do, because the function is unbounded and its hardest-to-round arguments cluster near the poles.
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.
COT · 1 lines · calc-func/src/catalogue/math.rs on GitHub12 cot "COT" (1, 1) [V "number"] |s, a, sv| { unary(s, a, k::cot::cot_kernel) }
cot_kernel · 10 lines · calc-func/src/ported/cot.rs on GitHubpub fn cot_kernel(n: f64) -> Result<f64, WorksheetErrorCode> {
ExcelRealPolicy::CIRCULAR_TRIG.check_arg(n)?;
// W109 G4-01: COT = RN53(RN64(1/TAN)) over the published TAN chain
// (the double-rounded x87 reciprocal, unique surviving staging).
let tan = crate::ported::excel_numeric::excel_tan(n);
if tan == 0.0 {
return Err(WorksheetErrorCode::Div0);
}
Ok(crate::ported::excel_numeric::excel_x87_recip(tan))
}
unary catalogue/mathbinary_with ported/excel_numerictan_with ported/excel_numericexcel_tan ported/excel_numericexcel_x87_recip ported/excel_numericpack_raw ported/excel_numeric/soft87zero ported/excel_numeric/soft87inf ported/excel_numeric/soft87pack ported/excel_numeric/soft87ext_pi ported/excel_numeric/soft87ext_one ported/excel_numeric/soft87ext_chs ported/excel_numeric/soft87recip ported/excel_numeric/x87No implementation has been published with a Handbook test suite for this function.
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 build | Platform and CPU | Captured inputs |
|---|---|---|
| 19929 | Windows, bitness not recorded, CPU not recorded | 31 |
| 20131 | Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics | 906 |
| 20430 | Windows, 64-bit, CPU not recorded | 1,224 |
Agreement on these compared inputs does not establish agreement on unmeasured inputs.
Recorded environments and comparison details.
Windows, bitness not recorded, CPU not recorded
31 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.
Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics
906 captured inputs are indexed for this environment. Capture dates: 2026-07-11 to 2026-07-11. This is a reading count, not a comparison with another build.
Windows, 64-bit, CPU not recorded
1,224 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.
TAN — the reciprocal, and the surface COT is built from. EV-MATH-0004 records that
the three reciprocal surfaces are formed as excel_x87_recip of the published primaries;
for COT the primary is the tangent chain (FPTAN). That construction is the single most
useful implementation fact on this page.SIN — the ratio definition. Note that COS(x)/SIN(x) and
1/TAN(x) are different computations with different error, even though they are the same
function: the first divides two rounded values, the second inverts one.ACOT — the inverse, principal range (0, π). Note that ACOT in Excel returns a value
in (0, π) rather than (-π/2, π/2), so ACOT(COT(x)) folds into (0, π).SEC — the other two reciprocals introduced alongside COT, sharing
its documentation template and its constraint.IMCOT — the complex-argument version.No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents