Skip to content

Commit 2361b49

Browse files
committed
Add overview for RealModule documentation.
1 parent 5cc83cc commit 2361b49

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed
Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
# ``RealModule``
22

3-
A module that extends the Swift standard library protocols to provide
4-
additional operations for floating-point types.
3+
Extensions on the Swift standard library that provide functionality for
4+
floating-point types.
55

66
## Overview
7+
8+
``RealModule`` provides four protocols that extend the standard library's
9+
numeric protocol hierarchy: AlgebraicField, ElementaryFunctions,
10+
RealFunctions, and Real.
11+
12+
Types conforming to AlgebraicField represent
13+
[fields](https://en.wikipedia.org/wiki/Field_(mathematics)). These are the
14+
mathematical structures that typically form the elements of vectors and
15+
matrices, so this protocol is appropriate for writing generic code to do
16+
linear-algebra-type operations.
17+
18+
ElementaryFunctions provides bindings for the "math functions": the logarithm
19+
and exponential functions, sine, cosine and tangent as well as their inverses,
20+
and other functions that you may be familiar with from trigonometry and
21+
calculus. RealFunctions refines ElementaryFunctions and provides functions that
22+
are primarily used with the real numbers, such as atan2, erf and gamma, and
23+
the base-2 and -10 logarithm and exponential funtions.
24+
25+
The Real protocol is a convenient name for the intersection of `FloatingPoint`,
26+
`RealFunctions`, and `AlgebraicField`; this is the protocol that you are most
27+
likely to want to constrain to when writing generic "math" code that works
28+
with floating-point types.

0 commit comments

Comments
 (0)