|
1 | 1 | # ``RealModule``
|
2 | 2 |
|
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. |
5 | 5 |
|
6 | 6 | ## 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