|
125 | 125 | ///
|
126 | 126 | /// let temperatureData = ["21.5", "19.25", "27", "no data", "28.25", "no data", "23"]
|
127 | 127 | /// let tempsCelsius = temperatureData.map { Double($0) ?? .nan }
|
128 |
| -/// // tempsCelsius == [21.5, 19.25, 27, nan, 28.25, nan, 23.0] |
| 128 | +/// print(tempsCelsius) |
| 129 | +/// // Prints "[21.5, 19.25, 27, nan, 28.25, nan, 23.0]" |
| 130 | +/// |
129 | 131 | ///
|
130 | 132 | /// Note that some elements in the `temperatureData ` array are not valid
|
131 | 133 | /// numbers. When these invalid strings are parsed by the `Double` failable
|
|
135 | 137 | /// Next, the observations in Celsius are converted to Fahrenheit:
|
136 | 138 | ///
|
137 | 139 | /// let tempsFahrenheit = tempsCelsius.map { $0 * 1.8 + 32 }
|
138 |
| -/// // tempsFahrenheit == [70.7, 66.65, 80.6, nan, 82.85, nan, 73.4] |
| 140 | +/// print(tempsFahrenheit) |
| 141 | +/// // Prints "[70.7, 66.65, 80.6, nan, 82.85, nan, 73.4]" |
139 | 142 | ///
|
140 | 143 | /// The NaN values in the `tempsCelsius` array are propagated through the
|
141 | 144 | /// conversion and remain NaN in `tempsFahrenheit`.
|
@@ -1104,7 +1107,8 @@ public protocol FloatingPoint: SignedNumeric, Strideable, Hashable
|
1104 | 1107 | ///
|
1105 | 1108 | /// var numbers = [2.5, 21.25, 3.0, .nan, -9.5]
|
1106 | 1109 | /// numbers.sort { !$1.isTotallyOrdered(belowOrEqualTo: $0) }
|
1107 |
| - /// // numbers == [-9.5, 2.5, 3.0, 21.25, NaN] |
| 1110 | + /// print(numbers) |
| 1111 | + /// // Prints "[-9.5, 2.5, 3.0, 21.25, nan]" |
1108 | 1112 | ///
|
1109 | 1113 | /// The `isTotallyOrdered(belowOrEqualTo:)` method implements the total order
|
1110 | 1114 | /// relation as defined by the [IEEE 754 specification][spec].
|
|
0 commit comments