Excel 16.0 build 19929
Windows, bitness not recorded, CPU not recorded
33 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,141 recorded answers
Recorded: 2,138 in the answer bank and 3 workbook cells. How we measure this · See the Rust code
| Language | Name in Excel |
|---|---|
| Arabic | SEC |
| Bulgarian | SEC |
| Czech | SEC |
| Danish | SEC |
| German | SEC |
| Greek | SEC |
| English (Australia) | SEC |
| English (United Kingdom) | SEC |
| English (United States) | SEC |
| Spanish | SEC |
| Estonian | SEC |
| Finnish | SEK |
| French | SEC |
| Hebrew | SEC |
| Croatian | SEC |
| Hungarian | SEC |
| Indonesian | SEC |
| Italian | SEC |
| Japanese | SEC |
| Korean | SEC |
| Lithuanian | SEC |
| Latvian | SEC |
| Norwegian | SEC |
| Dutch | SECONDE |
| Polish | SEC |
| Portuguese (Brazil) | SEC |
| Portuguese (Portugal) | SEC |
| Romanian | SEC |
| Russian | SEC |
| Slovak | SEC |
| Slovenian | SEC |
| Serbian (Latin) | SEC |
| Swedish | SEK |
| Thai | SEC |
| Turkish | SEC |
| Ukrainian | SEC |
| Vietnamese | SEC |
| Chinese (Simplified) | SEC |
| Chinese (Hong Kong) | SEC |
| Chinese (Traditional) | SEC |
Names from Microsoft's support site.
SEC(number)
SEC(number) returns the secant of an angle given in radians.
sec x = 1 / cos x
Domain. All real x except the zeros of cosine, x = π/2 + kπ for integer k, where secant
has simple poles. Range. |sec x| ≥ 1: the values (−1, 1) are never attained. The function
is even, 2π-periodic, and satisfies the Pythagorean identity
sec²x − tan²x = 1
Its derivative is sec x · tan x, and its Maclaurin series is the Euler-number generating function
sec x = Σ_{n≥0} |E_{2n}| x^{2n} / (2n)! = 1 + x²/2 + 5x⁴/24 + 61x⁶/720 + …
convergent for |x| < π/2 — the radius is exactly the distance to the nearest pole, which is the
compact statement of why this function is hard near π/2. (A&S 4.3.68.)
A fact worth stating before the numerics. No binary64 value is exactly π/2 + kπ, because
those points are irrational. So SEC never actually divides by zero on a machine: it divides by a
very small number and returns a very large one. The pole is unreachable, and everything difficult
about the function happens in its neighbourhood rather than at it.
| Argument | Meaning | Default |
|---|---|---|
number | The angle, in radians, whose secant is wanted. Required. | — |
Degrees must be converted first: SEC(RADIANS(d)). See RADIANS for what that
conversion costs, which matters more here than for most consumers because of the amplification
described below.
Microsoft's VBA page for this method is three lines long: a one-sentence description, the single argument, the return type. No remarks, no domain restriction, no error condition.
Returns Number.
SEC(0) is exactly 1, and it is one of the few inputs where an exact answer is available.x approaches π/2 the
returned value grows without bound; the relative accuracy of that value degrades in proportion
to how well the argument's last bits locate x relative to the pole. See the numerical notes.| Error | Condition | Source |
|---|---|---|
#NUM! | |number| ≥ 2²⁷ | observed live Excel, catalogue XMD-005; not documented |
#VALUE! | The argument does not convert to a number | shared coercion model |
| propagated | The argument is an error value | shared coercion model |
Microsoft's documentation states none of these.
The condition number is the whole story. Differentiating, the relative error in sec x
produced by a relative error ε in x is
|x · d(sec x)/dx / sec x| · ε = |x · tan x| · ε
so the amplification factor is |x tan x|, which is unbounded as x approaches a pole. Near
π/2, a last-bit perturbation of the argument moves the result by an arbitrarily large relative
amount. This is not an implementation weakness; it is a property of the function, and it means that
no implementation can return an accurate secant near a pole from an inexact argument. The
honest response is to say so, which most libraries do not.
Argument reduction is where the accuracy is won or lost. Evaluating cos x requires x mod 2π, and the modulus must be taken against the real π rather than against fl(π) — every bit by
which |x| exceeds π costs a bit of the reduced argument if the reduction uses a rounded constant.
The standard remedy is Payne–Hanek reduction against a many-word 2/π, as implemented in fdlibm's
__ieee754_rem_pio2; it is exact for every finite double and costs a bounded amount of work.
Excel's recorded behaviour is the alternative policy: refuse. A cutoff at 2²⁷ is
approximately where a reduction using a double-precision π begins to lose the low half of the
reduced argument, so the threshold reads as the point at which the implementer stopped trusting
their own reduction. The Handbook's position is that both are defensible engineering, that only one
of them is documented (neither), and that a natural-best implementation should reduce correctly
and return a value where Excel returns an error — which is a deliberate, declared divergence, not a
compatibility bug. See About implementation options.
Host-CPU dependence. EV-MATH-0004's reader warning records that all six circular surfaces
inherit a host-CPU microcode caveat on the x87 FPREM1, FSIN and FPTAN instructions. In plain
terms: the value may depend on which processor evaluates it. That is a portable-reproducible
concern, and it is the reason a suite for this function would have to name a CPU as well as an
Excel build.
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.
SEC · 1 lines · calc-func/src/catalogue/math.rs on GitHub16 sec "SEC" (1, 1) [V "number"] |s, a, sv| { unary(s, a, k::sec::sec_kernel) }
sec_kernel · 9 lines · calc-func/src/ported/sec.rs on GitHubpub fn sec_kernel(n: f64) -> Result<f64, WorksheetErrorCode> {
ExcelRealPolicy::CIRCULAR_TRIG.check_arg(n)?;
// W109 G4-01: SEC = RN53(RN64(1/cos)) over the RAW COS chain (the
// published-COS small-argument 1.0 shortcut composes identically here:
// recip-dr of 1-ulp ties back to exactly 1.0).
Ok(crate::ported::excel_numeric::excel_x87_recip(
crate::ported::excel_numeric::excel_cos(n),
))
}
unary catalogue/mathbinary_with ported/excel_numericcos_with ported/excel_numericexcel_cos 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_abs 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 | 33 |
| 20131 | Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics | 914 |
| 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
33 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
914 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.
CSC and COT — the other two reciprocals, of SIN and TAN. All three share the
2²⁷ guard, all three are built on two kernels, and all three carry the same host-CPU caveat.TAN — related by sec²x = 1 + tan²x, which is the numerically preferable route to sec
when tan is already available and x is near a pole: computing sqrt(1 + tan²x) avoids the
division by a tiny cosine, at the cost of losing the sign, which must be restored from the
quadrant.sech(x) = sec(ix).ACOS — there is no ASEC. The inverse secant must be written ACOS(1/x), which is defined
for |x| ≥ 1 and inherits a division by the argument.No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents