Add documentation for AdditiveArithmetic conformance of ElementaryFunctions

This commit is contained in:
Stephen Canon committed 2019-11-10 21:12:37 -05:00
1 parent d064661dba
commit 6d904ea56c
2 files changed
+5

No files matched your search

+3
View File
@@ -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
+2
View File
@@ -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.