Skip to content

Commit a47932b

Browse files
author
Maxim Moiseev
committed
[stdlib] init<T : FloatingPoint> ==> init<T : BinaryFloatingPoint>
(cherry picked from commit 5d47a0d)
1 parent 1bf8e41 commit a47932b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

stdlib/public/core/Integers.swift.gyb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ public protocol BinaryInteger :
13291329
/// // y == nil
13301330
///
13311331
/// - Parameter source: A floating-point value to convert to an integer.
1332-
init?<T : FloatingPoint>(exactly source: T)
1332+
init?<T : BinaryFloatingPoint>(exactly source: T)
13331333

13341334
/// Creates an integer from the given floating-point value, rounding toward
13351335
/// zero.
@@ -1347,7 +1347,7 @@ public protocol BinaryInteger :
13471347
///
13481348
/// - Parameter source: A floating-point value to convert to an integer.
13491349
/// `source` must be representable in this type after rounding toward zero.
1350-
init<T : FloatingPoint>(_ source: T)
1350+
init<T : BinaryFloatingPoint>(_ source: T)
13511351

13521352
/// Creates a new instance from the given integer.
13531353
///
@@ -1538,7 +1538,7 @@ extension BinaryInteger {
15381538
self = 0
15391539
}
15401540

1541-
public init?<T : FloatingPoint>(exactly source: T) {
1541+
public init?<T : BinaryFloatingPoint>(exactly source: T) {
15421542
// FIXME(integers): implement
15431543
fatalError()
15441544
}
@@ -2939,7 +2939,7 @@ ${assignmentOperatorComment(x.operator, True)}
29392939

29402940
extension ${Self} {
29412941
// FIXME(integers): implement me in a less terrible way
2942-
public init<T : FloatingPoint>(_ source: T) {
2942+
public init<T : BinaryFloatingPoint>(_ source: T) {
29432943
% for (FloatType, FloatBits) in [
29442944
% ('Float', 32), ('Double', 64), ('Float80', 80)]:
29452945
% if FloatType == 'Float80':

test/Prototypes/BigInt.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ public struct _BigInt<Word: FixedWidthInteger & UnsignedInteger> :
142142
self.init(source)
143143
}
144144

145-
public init<T : FloatingPoint>(_ source: T) {
145+
public init<T : BinaryFloatingPoint>(_ source: T) {
146146
fatalError("Not implemented")
147147
}
148148

149-
public init?<T : FloatingPoint>(exactly source: T) {
149+
public init?<T : BinaryFloatingPoint>(exactly source: T) {
150150
fatalError("Not implemented")
151151
}
152152

@@ -1197,7 +1197,7 @@ struct Bit : FixedWidthInteger, UnsignedInteger {
11971197
self = value
11981198
}
11991199

1200-
init?<T: FloatingPoint>(exactly source: T) {
1200+
init?<T: BinaryFloatingPoint>(exactly source: T) {
12011201
switch source {
12021202
case T(0): value = 0
12031203
case T(1): value = 1
@@ -1206,7 +1206,7 @@ struct Bit : FixedWidthInteger, UnsignedInteger {
12061206
}
12071207
}
12081208

1209-
init<T: FloatingPoint>(_ source: T) {
1209+
init<T: BinaryFloatingPoint>(_ source: T) {
12101210
self = Bit(exactly: source.rounded(.down))!
12111211
}
12121212

0 commit comments

Comments
 (0)