mirror of
https://github.com/apple/swift-numerics
synced 2026-11-22 04:30:45 +00:00
Add overview for RealModule documentation.
This commit is contained in:
1 file changed
+24
-2
@@ -1,6 +1,28 @@
|
||||
# ``RealModule``
|
||||
|
||||
A module that extends the Swift standard library protocols to provide
|
||||
additional operations for floating-point types.
|
||||
Extensions on the Swift standard library that provide functionality for
|
||||
floating-point types.
|
||||
|
||||
## Overview
|
||||
|
||||
``RealModule`` provides four protocols that extend the standard library's
|
||||
numeric protocol hierarchy: AlgebraicField, ElementaryFunctions,
|
||||
RealFunctions, and Real.
|
||||
|
||||
Types conforming to AlgebraicField represent
|
||||
[fields](https://en.wikipedia.org/wiki/Field_(mathematics)). These are the
|
||||
mathematical structures that typically form the elements of vectors and
|
||||
matrices, so this protocol is appropriate for writing generic code to do
|
||||
linear-algebra-type operations.
|
||||
|
||||
ElementaryFunctions provides bindings for the "math functions": the logarithm
|
||||
and exponential functions, sine, cosine and tangent as well as their inverses,
|
||||
and other functions that you may be familiar with from trigonometry and
|
||||
calculus. RealFunctions refines ElementaryFunctions and provides functions that
|
||||
are primarily used with the real numbers, such as atan2, erf and gamma, and
|
||||
the base-2 and -10 logarithm and exponential funtions.
|
||||
|
||||
The Real protocol is a convenient name for the intersection of `FloatingPoint`,
|
||||
`RealFunctions`, and `AlgebraicField`; this is the protocol that you are most
|
||||
likely to want to constrain to when writing generic "math" code that works
|
||||
with floating-point types.
|
||||
Reference in new issue
Block a user