Skip to content

Commit 036d59c

Browse files
authored
Merge pull request #31729 from valeriyvan/FixExampleSnippetFloatingPoint.swift
2 parents 2492e45 + d6b2d06 commit 036d59c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

stdlib/public/core/FloatingPoint.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@
125125
///
126126
/// let temperatureData = ["21.5", "19.25", "27", "no data", "28.25", "no data", "23"]
127127
/// 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+
///
129131
///
130132
/// Note that some elements in the `temperatureData ` array are not valid
131133
/// numbers. When these invalid strings are parsed by the `Double` failable
@@ -135,7 +137,8 @@
135137
/// Next, the observations in Celsius are converted to Fahrenheit:
136138
///
137139
/// 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]"
139142
///
140143
/// The NaN values in the `tempsCelsius` array are propagated through the
141144
/// conversion and remain NaN in `tempsFahrenheit`.
@@ -1104,7 +1107,8 @@ public protocol FloatingPoint: SignedNumeric, Strideable, Hashable
11041107
///
11051108
/// var numbers = [2.5, 21.25, 3.0, .nan, -9.5]
11061109
/// 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]"
11081112
///
11091113
/// The `isTotallyOrdered(belowOrEqualTo:)` method implements the total order
11101114
/// relation as defined by the [IEEE 754 specification][spec].

0 commit comments

Comments
 (0)