ATAN(3POSIX)
π¦ ATAN β the POSIX Programmer's Manual page, bestie edition π
okay so quick vibe check before we even start: this one lives in the POSIX Programmer's Manual. That's the manual name, that's the whole set, and it's iconic.
β¨ PROLOG β¨
so like, real talk π this manual page is part of the POSIX Programmer's Manual. That means: the Linux implementation of this interface may differ β so if you're on Linux, go consult the corresponding Linux manual page for the details of Linux behavior β or the interface may not even be implemented on Linux at all. no cap, that's just how it is π
π NAME π
atan, atanf, atanl β arc tangent function. that's it, that's the whole name section, she's brief and she's slaying β¨
πΈ SYNOPSIS πΈ
#include <math.h>
double atan(double x);
float atanf(float x);
long double atanl(long double x);
three sisters, three types, one job π«Ά
π DESCRIPTION π
so the functionality described on this reference page is aligned with the ISO C standard. and if there's any conflict between the requirements described here and the ISO C standard β that's unintentional, bestie, nobody did that on purpose π. This volume of POSIX.1β2017 defers to the ISO C standard. periodt.
These functions shall compute the principal value of the arc tangent of their argument x. that's the assignment. that's the whole assignment π
now β if your application wants to check for error situations (and she's a thorough queen so maybe you do β¨), here's the ritual:
- set
errnoto zero - call
feclearexcept(FE_ALL_EXCEPT) - before calling these functions
then on return, if errno is non-zero, or if fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero β an error has occurred. that's the signal, that's the tea π
π RETURN VALUE π
Upon successful completion, these functions shall return the arc tangent of x in the range [-Ο/2,Ο/2] radians. cute range, love that for her π
here's the whole rundown, no skipping:
- If
xisNaN, aNaNshall be returned. - If
xisΒ±0,xshall be returned. (she returns herself. self-love π ) - If
xisΒ±Inf,Β±Ο/2shall be returned. - If
xis subnormal, a range error may occur andxshould be returned. - If
xis not returned,atan(),atanf(), andatanl()shall return an implementation-defined value no greater in magnitude thanDBL_MIN,FLT_MIN, andLDBL_MIN, respectively.
π₯ ERRORS π₯
These functions may fail if:
- Range Error β The value of
xis subnormal.- If the integer expression
(math_errhandling & MATH_ERRNO)is non-zero, thenerrnoshall be set to[ERANGE]. - If the integer expression
(math_errhandling & MATH_ERREXCEPT)is non-zero, then the underflow floating-point exception shall be raised.
- If the integer expression
The following sections are informative. π«Ά so like, the vibes are advisory from here on out, bestie.
π§ EXAMPLES π§
None. literally none. she said "figure it out, you're smart" ππ
β APPLICATION USAGE β
On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other β they don't text each other, they don't coordinate, nothing β but at least one of them must be non-zero. that's the rule. respect it πΈ
π RATIONALE π
None. the reasoning section is empty because the reasoning is self-evident, bestie β¨
π¦ FUTURE DIRECTIONS π¦
None. the future is unwritten and also this function is not changing π
π SEE ALSO π
atan2()feclearexcept()fetestexcept()isnan()tan()
and also, from The Base Definitions volume of POSIX.1β2017:
- Section 4.20, Treatment of Error Conditions for Mathematical Functions
<math.h>
go read those, iykyk πβ¨
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
okay bestie that's the whole page, we ate and left no crumbs π
signing off with the official receipts: IEEE/The Open Group, 2017, and this page's name in the manual is ATAN(3POSIX) π β¨ππ¦
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms