@@ -205,10 +205,32 @@ public protocol _ExpressibleByBuiltinFloatLiteral {
205
205
init ( _builtinFloatLiteral value: _MaxBuiltinFloatType )
206
206
}
207
207
208
- /// Conforming types can be initialized with floating point literals.
208
+ /// A type that can be initialized with a floating-point literal.
209
+ ///
210
+ /// The standard library floating-point types---`Float`, `Double`, and
211
+ /// `Float80` where available---all conform to the `ExpressibleByFloatLiteral`
212
+ /// protocol. You can initialize a variable or constant of any of these types
213
+ /// by assigning a floating-point literal.
214
+ ///
215
+ /// // Type inferred as 'Double'
216
+ /// let threshold = 6.0
217
+ ///
218
+ /// // An array of 'Double'
219
+ /// let measurements = [2.2, 4.1, 3.65, 4.2, 9.1]
220
+ ///
221
+ /// Conforming to ExpressibleByFloatLiteral
222
+ /// =======================================
223
+ ///
224
+ /// To add `ExpressibleByFloatLiteral` conformance to your custom type,
225
+ /// implement the required initializer.
209
226
public protocol ExpressibleByFloatLiteral {
227
+ /// A type that can represent a floating-point literal.
228
+ ///
229
+ /// Valid types for `FloatLiteralType` are `Float`, `Double`, and `Float80`
230
+ /// where available.
210
231
associatedtype FloatLiteralType : _ExpressibleByBuiltinFloatLiteral
211
- /// Create an instance initialized to `value`.
232
+
233
+ /// Creates an instance initialized to the specified floating-point value.
212
234
init ( floatLiteral value: FloatLiteralType )
213
235
}
214
236
0 commit comments