Skip to content

Commit 4afecc8

Browse files
Commit
1 parent 8d73c5f commit 4afecc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+605
-1046
lines changed

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,24 @@ let package: Package = .init(
99
.library(name: "NumericProtocols", targets: ["NumericProtocols"])
1010
],
1111
dependencies: [
12-
.package(url: "https://github.com/apple/swift-docc-plugin.git", .upToNextMinor(from: "1.3.0"))
12+
.package(url: "https://github.com/swiftlang/swift-docc-plugin.git", .upToNextMajor(from: "1.4.2"))
1313
],
1414
targets: [
15-
.target(name: "NumericProtocols", path: "Sources"),
16-
.testTarget(name: "NumericProtocolsTests", dependencies: ["NumericProtocols"], path: "Tests")
15+
.target(
16+
name: "NumericProtocols",
17+
path: "Sources",
18+
swiftSettings: [
19+
.enableExperimentalFeature("StrictConcurrency=complete")
20+
]
21+
),
22+
.testTarget(
23+
name: "NumericProtocolsTests",
24+
dependencies: ["NumericProtocols"],
25+
path: "Tests",
26+
swiftSettings: [
27+
.enableExperimentalFeature("StrictConcurrency=complete")
28+
]
29+
)
1730
],
1831
swiftLanguageVersions: [.v5]
1932
)

Sources/NumericProtocols/Numerics/Float16+.swift renamed to Sources/NumericProtocols/Numerics/Float16.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Float16+.swift
2+
// Float16.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/Float32+.swift renamed to Sources/NumericProtocols/Numerics/Float32.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Float32+.swift
2+
// Float32.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/Float64+.swift renamed to Sources/NumericProtocols/Numerics/Float64.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Float64+.swift
2+
// Float64.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/Int+.swift renamed to Sources/NumericProtocols/Numerics/Int.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Int+.swift
2+
// Int.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/Int16+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/Int16.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Int16+.swift
2+
// Int16.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/Int32+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/Int32.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Int32+.swift
2+
// Int32.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/Int64+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/Int64.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Int64+.swift
2+
// Int64.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/Int8+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/Int8.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Int8+.swift
2+
// Int8.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/UInt+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/UInt.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// UInt+.swift
2+
// UInt.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/UInt16+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/UInt16.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// UInt16+.swift
2+
// UInt16.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/UInt32+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/UInt32.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// UInt32+.swift
2+
// UInt32.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/UInt64+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/UInt64.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// UInt64+.swift
2+
// UInt64.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Numerics/UInt8+Subtractable.swift renamed to Sources/NumericProtocols/Numerics/UInt8.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// UInt8+.swift
2+
// UInt8.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad

Sources/NumericProtocols/Protocols/Addable.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
/// Representing values that can be added.
1010
public protocol Addable: Equatable {
11-
12-
// MARK: - Adding Values
13-
1411
/// Returns the sum of adding the two specified values.
1512
///
1613
/// - parameter lhs: The augend.
@@ -20,9 +17,6 @@ public protocol Addable: Equatable {
2017
}
2118

2219
extension Addable {
23-
24-
// MARK: - Adding Values
25-
2620
/// Adds the two specified values and stores the sum in the left-hand-side variable.
2721
///
2822
/// - parameter lhs: The augend.

Sources/NumericProtocols/Protocols/Comparable+.swift renamed to Sources/NumericProtocols/Protocols/Comparable.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
//
2-
// Comparable+.swift
2+
// Comparable.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88

99
extension Comparable {
10-
11-
// MARK: - Inspecting Values
12-
1310
/// Returns a boolean value indicating whether this value is less than the specified value.
1411
///
1512
/// - parameter rhs: Another value to compare.

Sources/NumericProtocols/Protocols/Decreasable.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
public protocol Decreasable: Increasable {}
1111

1212
extension Decreasable {
13-
14-
// MARK: - Decreasing Values
15-
16-
/// Returns the difference of descreasing this value by the specified value.
13+
/// Returns the difference of decreasing this value by the specified value.
1714
///
1815
/// ```swift
1916
/// let value: Double = Double(10)

Sources/NumericProtocols/Protocols/Divisible.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
/// Representing values that can be divided.
1010
public protocol Divisible: Equatable {
11-
12-
// MARK: - Dividing Values
13-
1411
/// Returns the quotient of dividing the first specified value by the second.
1512
///
1613
/// - parameter lhs: The dividend.
@@ -28,9 +25,6 @@ public protocol Divisible: Equatable {
2825

2926
extension Divisible
3027
where Self: ExpressibleByIntegerLiteral {
31-
32-
// MARK: - Instance Properties
33-
3428
/// Returns the reciprocal of this instance.
3529
public var reciprocal: Self? {
3630
return 1 / self
@@ -39,9 +33,6 @@ where Self: ExpressibleByIntegerLiteral {
3933

4034
extension Divisible
4135
where Self: ExpressibleByIntegerLiteral & RepresentableByZero {
42-
43-
// MARK: - Instance Properties
44-
4536
/// Returns the reciprocal of this instance.
4637
public var reciprocal: Self? {
4738
guard self.isInvertible else {
@@ -54,19 +45,13 @@ where Self: ExpressibleByIntegerLiteral & RepresentableByZero {
5445

5546
extension Divisible
5647
where Self: RepresentableByZero {
57-
58-
// MARK: - Inspecting Values
59-
6048
/// A boolean value indicating whether this instance is invertible.
6149
public var isInvertible: Bool {
6250
return self.isZero == false
6351
}
6452
}
6553

6654
extension Divisible {
67-
68-
// MARK: - Inspecting Values
69-
7055
/// Returns a boolean value indicating whether this value is divisible by the specified value.
7156
///
7257
/// ```swift
@@ -95,8 +80,6 @@ extension Divisible {
9580
return (other % self) == 0
9681
}
9782

98-
// MARK: - Dividing Values
99-
10083
/// Divides the first specified value by the second and stores the quotient in the left-hand-side variable.
10184
///
10285
/// - parameter lhs: The dividend.
@@ -140,8 +123,6 @@ extension Divisible {
140123
self /= divisor
141124
}
142125

143-
// MARK: - Halving Values
144-
145126
/// Returns this value halved.
146127
///
147128
/// ```swift
@@ -171,9 +152,6 @@ extension Divisible {
171152

172153
extension Divisible
173154
where Self: ExpressibleByFloatLiteral {
174-
175-
// MARK: - Other Values
176-
177155
/// The value representing one tenth.
178156
public static var tenth: Self {
179157
return 1e-1

Sources/NumericProtocols/Protocols/Equatable+.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
//
2-
// Equatable+.swift
2+
// Equatable.swift
33
// NumericProtocols
44
//
55
// Copyright © 2021-2024 Alexandre H. Saad
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88

99
extension Equatable {
10-
11-
// MARK: - Inspecting Values
12-
1310
/// Returns a boolean value indicating whether this value is equal to the specified value.
1411
///
1512
/// - parameter rhs: Another value to compare.
@@ -29,9 +26,6 @@ extension Equatable {
2926

3027
extension Equatable
3128
where Self: Divisible & ExpressibleByIntegerLiteral {
32-
33-
// MARK: - Instance Properties
34-
3529
/// A boolean value indicating whether this value is even.
3630
///
3731
/// ```swift

Sources/NumericProtocols/Protocols/Equivalentable.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88

9-
// FIXME: change name of protocol.
9+
// TODO: change name of protocol.
1010
/// Representing values that can be equivalent.
1111
public protocol Equivalentable {
12-
13-
// MARK: - Inspecting Values
14-
1512
/// Returns a boolean value indicating whether the two specified instances are equivalent.
1613
///
1714
/// - parameter rhs: An instance to compare.

Sources/NumericProtocols/Protocols/Increasable.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
public protocol Increasable: BinaryFloatingPoint {}
1111

1212
extension Increasable {
13-
14-
// MARK: - Increasing Values
15-
1613
/// Returns the sum of increasing this value by the specified value.
1714
///
1815
/// ```swift

Sources/NumericProtocols/Protocols/Multipliable.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
/// Representing values that can be multiplied.
1010
public protocol Multipliable: Equatable {
11-
12-
// MARK: - Multiplying Values
13-
1411
/// Returns the product of multiplying the two specified values.
1512
///
1613
/// - parameter lhs: The multiplicand.
@@ -20,9 +17,6 @@ public protocol Multipliable: Equatable {
2017
}
2118

2219
extension Multipliable {
23-
24-
// MARK: - Inspecting Values
25-
2620
// FIXME: Ambiguous use of 'isMultiple(of:)'.
2721
/// Returns a boolean value indicating whether this value is a multiple of the specified value.
2822
///
@@ -60,8 +54,6 @@ extension Multipliable {
6054
return (self % other) == 0.0
6155
}
6256

63-
// MARK: - Multiplying Values
64-
6557
/// Multiplies the two specified values and stores the product in the left-hand-side variable.
6658
///
6759
/// - parameter lhs: The multiplicand.
@@ -97,8 +89,6 @@ extension Multipliable {
9789
self *= multiplicator
9890
}
9991

100-
// MARK: - Doubling Values
101-
10292
/// Returns this value doubled.
10393
///
10494
/// ```swift

Sources/NumericProtocols/Protocols/Negateable.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
/// Representing values that can be negating.
1010
public protocol Negateable: Equatable {
11-
12-
// MARK: - Negating Values
13-
1411
/// Returns the additive inverse of the specified value.
1512
///
1613
/// - parameter operand:
@@ -20,9 +17,6 @@ public protocol Negateable: Equatable {
2017

2118
extension Negateable
2219
where Self: Comparable & RepresentableByZero {
23-
24-
// MARK: - Inspecting Values
25-
2620
/// A boolean value indicating whether this value is negative.
2721
///
2822
/// ```swift
@@ -45,9 +39,6 @@ where Self: Comparable & RepresentableByZero {
4539
}
4640

4741
extension Negateable {
48-
49-
// MARK: - Inspecting Values
50-
5142
/// A boolean value indicating whether this value is signed.
5243
///
5344
/// ```swift
@@ -71,8 +62,6 @@ extension Negateable {
7162
return self == other.negating()
7263
}
7364

74-
// MARK: - Negating Values
75-
7665
/// Returns the additive inverse of this value.
7766
///
7867
/// ```swift

0 commit comments

Comments
 (0)