Skip to content

Commit 9c54880

Browse files
committed
Massage docc files to make the Documentation check happier
1 parent acbf425 commit 9c54880

File tree

8 files changed

+38
-15
lines changed

8 files changed

+38
-15
lines changed

Sources/ComplexModule/Complex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ extension Complex {
185185
self.init(real, 0)
186186
}
187187

188-
/// The complex number with specified imaginary part and zero real part.
188+
/// The complex number with zero real part and specified imaginary part.
189189
///
190190
/// Equivalent to `Complex(0, imaginary)`.
191191
@inlinable

Sources/ComplexModule/Documentation.docc/Complex.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# ``Complex``
22

3-
A Complex number type that conforms to ``AlgebraicField`` (so all the normal
4-
arithmetic operations are available) and ``ElementaryFunctions`` (so all
5-
the usual math functions are available).
3+
A Complex number type that conforms to `AlgebraicField`
4+
(so all the normal arithmetic operations are available) and
5+
`ElementaryFunctions` (so all the usual math functions are
6+
available).
67

78
A `Complex` value is represented with two `RealType` values, corresponding to
89
the real and imaginary parts of the number.
@@ -42,7 +43,7 @@ details.
4243
- ``imaginary``
4344
- ``rawStorage``
4445
- ``init(_:_:)``
45-
- ``init(_:)-(RealType)``
46+
- ``init(_:)-5aesj``
4647
- ``init(imaginary:)``
4748

4849
### Phase, length and magnitude

Sources/ComplexModule/Documentation.docc/ComplexModule.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
Types and operations for working with complex numbers.
44

5-
## Representation
5+
## Overview
6+
7+
### Representation
68

79
The `Complex` type is generic over an associated `RealType`; complex numbers
810
are represented as two `RealType` values, the real and imaginary parts of the
@@ -28,7 +30,7 @@ Functions taking complex arguments in these other languages are not
2830
automatically converted on import, but you can safely write shims that
2931
map them into Swift types by converting pointers.
3032

31-
## Real-Complex arithmetic
33+
### Real-Complex arithmetic
3234

3335
Because the real numbers are a subset of the complex numbers, many
3436
languages support arithmetic with mixed real and complex operands.

Sources/ComplexModule/Documentation.docc/Infinity.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Semantics of `Complex` zero and infinity values, and important considerations
44
when porting code from other languages.
55

6+
## Overview
7+
68
Unlike C and C++'s complex types, `Complex` does not attempt to make a
79
semantic distinction between different infinity and NaN values. Any `Complex`
810
datum with a non-finite component is treated as the "point at infinity" on
@@ -12,7 +14,7 @@ As a consequence, all values with either component infinite or NaN compare
1214
equal, and hash the same. Similarly, all zero values compare equal and hash
1315
the same.
1416

15-
## Rationale
17+
### Rationale
1618

1719
This choice has some drawbacks,¹ but also some significant advantages.
1820
In particular, complex multiplication is the most common operation performed

Sources/ComplexModule/Documentation.docc/Magnitude.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Introduction to the concept of norm and discussion of the `Complex` type's
44
`.magnitude` property.
55

6+
## Overview
7+
68
In mathematics, a *norm* is a function that gives each element of a vector
79
space a non-negative length.¹
810

@@ -33,7 +35,7 @@ The three most commonly-used norms are:
3335
The `Complex` type gives special names to two of these norms; `length`
3436
for the 2-norm, and `magnitude` for the ∞-norm.
3537

36-
## Magnitude:
38+
### Magnitude:
3739

3840
The `Numeric` protocol requires us to choose a norm to call `magnitude`,
3941
but does not give guidance as to which one we should pick. The easiest choice
@@ -68,7 +70,7 @@ Complex(2, 3).magnitude // 3
6870
Complex(-1, 0.5).magnitude // 1
6971
```
7072

71-
## Length:
73+
### Length:
7274

7375
The `length` property of a `Complex` value is its Euclidean norm.
7476

Sources/RealModule/AugmentedArithmetic.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
/// Namespace for augmented arithmetic operations.
1213
public enum Augmented { }
1314

1415
extension Augmented {
@@ -96,10 +97,11 @@ extension Augmented {
9697
/// error from that computation rounded to the closest representable
9798
/// value.
9899
///
99-
/// Unlike ``sum(large:small:)``, the magnitude of the summands does not
100-
/// matter. If you know statically that `a.magnitude >= b.magnitude`, you
101-
/// should use ``sum(large:small:)``. If you do not have such a static
102-
/// bound, you should use this function instead.
100+
/// The magnitude of the summands does not change the result of this
101+
/// operation. If you know statically that `a.magnitude >= b.magnitude`,
102+
/// you may want to consider using ``sum(large:small:)`` to get the same
103+
/// result somewhat more efficiently. If you do not have such a static
104+
/// bound, you usually want to use this function instead.
103105
///
104106
/// Unlike ``product(_:_:)``, the rounding error of a sum never underflows.
105107
///

Sources/RealModule/Documentation.docc/Augmented.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ``Augmented``
22

3+
A namespace for a family of algorithms that compute the results of floating-
4+
point arithmetic using multiple values such that either the error is minimized
5+
or the result is exact.
6+
37
## Overview
48

59
Consider multiplying two Doubles. A Double has 53 significand bits, so their
@@ -17,4 +21,11 @@ the low-order part of the product suddenly becomes significant:
1721
let result = 1 - c // exactly zero, but "should be" 2⁻¹⁰⁴
1822
```
1923
Augmented arithmetic is a building-block that library writers can use to
20-
handle cases like this more carefully.
24+
handle cases like this more carefully. For the example above, one might
25+
compute:
26+
```swift
27+
let (head, tail) = Augmented.product(a,b)
28+
```
29+
`head` is then 1.0 and `tail` is -2⁻¹⁰⁴, so no information has been lost.
30+
Of course, the result is now split across two Doubles instead of one, but the
31+
information in `tail` can be carried forward into future computations.

Sources/RealModule/Documentation.docc/Relaxed.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ``Relaxed``
22

3+
A namespace for a family of operations that "relax" the usual rules for
4+
floating-point to allow reassociation of arithmetic and FMA formation.
5+
36
## Overview
47

58
Because of rounding, and the arithmetic rules for infinity and NaN values,

0 commit comments

Comments
 (0)