mirror of
https://github.com/apple/swift-numerics
synced 2026-11-27 05:04:26 +00:00
Add documentation for AdditiveArithmetic conformance of ElementaryFunctions
This commit is contained in:
1 parent
d064661dba
commit
6d904ea56c
2 files changed
+5
No files matched your search
@@ -32,6 +32,9 @@
|
||||
/// - Power and root functions:
|
||||
/// `pow`, `sqrt`, and `root`.
|
||||
///
|
||||
/// `ElementaryFunctions` conformance implies `AdditiveArithmetic`, so addition
|
||||
/// and subtraction and the `.zero` property are also available.
|
||||
///
|
||||
/// There are two other protocols that you are more likely to want to use directly:
|
||||
///
|
||||
/// `RealFunctions` refines `ElementaryFunctions` and includes
|
||||
|
||||
@@ -15,6 +15,8 @@ The module defines three protocols. The most general is `ElementaryFunctions`, w
|
||||
- Inverse hyperbolic functions: `acosh`, `asinh`, `atanh`
|
||||
- Power and root functions: `pow`, `sqrt`, `root`
|
||||
|
||||
`ElementaryFunctions` refines `AdditiveArithmetic`, and so also provides addition, subtraction, and the `.zero` property.
|
||||
|
||||
The `RealFunctions` protocol refines `ElementaryFunctions`, and adds operations that are difficult to define or implement over fields more general than the real numbers:
|
||||
- `atan2(y:x:)`, which computes `atan(y/x)` with sign chosen by the quadrant of the point `(x,y)` in the Cartesian plane.
|
||||
- `hypot`, which computes `sqrt(x*x + y*y)` without intermediate overflow or underflow.
|
||||
|
||||
Reference in new issue
Block a user