Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves the documentation for atan and atan2 in the Math module #25832

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions modules/standard/Math.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -388,28 +388,36 @@ module Math {
return casinh(x);
}

/* Returns the arc tangent of the argument `x`. */
/* Returns the arc tangent of the argument `x`. The result lies in the
inclusive range [-pi/2,+pi/2].
*/
pragma "fn synchronization free"
pragma "codegen for CPU and GPU"
extern proc atan(x: real(64)): real(64);

/* Returns the arc tangent of the argument `x`. */
/* Returns the arc tangent of the argument `x`. The result lies in the
inclusive range [-pi/2,+pi/2].
*/
inline proc atan(x : real(32)): real(32) {
pragma "fn synchronization free"
pragma "codegen for CPU and GPU"
extern proc atanf(x: real(32)): real(32);
return atanf(x);
}

/* Returns the arc tangent of the argument `x`. */
/* Returns the arc tangent of the argument `x`. The result lies in the
inclusive range [-pi/2,+pi/2].
*/
inline proc atan(x: complex(64)): complex(64) {
pragma "fn synchronization free"
pragma "codegen for CPU and GPU"
extern proc catanf(z: complex(64)): complex(64);
return catanf(x);
}

/* Returns the arc tangent of the argument `x`. */
/* Returns the arc tangent of the argument `x`. The result lies in the
inclusive range [-pi/2,+pi/2].
*/
inline proc atan(x: complex(128)): complex(128) {
pragma "fn synchronization free"
pragma "codegen for CPU and GPU"
Expand All @@ -419,18 +427,20 @@ module Math {

/* Returns the arc tangent of the ratio of the two arguments.

This is equivalent to
the arc tangent of `y` / `x` except that the signs of `y`
and `x` are used to determine the quadrant of the result. */
This is the arc (or inverse) tangent of `y` / `x` which lies in the
inclusive range [-pi,+pi] where the signs of `y` and `x` are used to
determine the quadrant of the result.
*/
pragma "fn synchronization free"
pragma "codegen for CPU and GPU"
extern proc atan2(y: real(64), x: real(64)): real(64);

/* Returns the arc tangent of the ratio of the two arguments.

This is equivalent to
the arc tangent of `y` / `x` except that the signs of `y`
and `x` are used to determine the quadrant of the result. */
This is the arc (or inverse) tangent of `y` / `x` which lies in the
inclusive range [-pi,+pi] where the signs of `y` and `x` are used to
determine the quadrant of the result.
*/
inline proc atan2(y : real(32), x: real(32)): real(32) {
pragma "fn synchronization free"
pragma "codegen for CPU and GPU"
Expand Down