From c423f9592b1c8020d68085ebdae4b6413fcc5114 Mon Sep 17 00:00:00 2001 From: Sajjon Date: Fri, 8 Nov 2019 08:39:07 +0100 Subject: [PATCH 1/2] Fix typos in source code --- Sources/Complex/Arithmetic.swift | 2 +- Sources/Complex/Complex.swift | 6 +++--- Sources/Real/Real.swift | 2 +- Sources/Real/RealFunctions.swift | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Complex/Arithmetic.swift b/Sources/Complex/Arithmetic.swift index 226ae69..9d75f23 100644 --- a/Sources/Complex/Arithmetic.swift +++ b/Sources/Complex/Arithmetic.swift @@ -143,7 +143,7 @@ extension Complex: Numeric { /// The reciprocal of this value, if it can be computed without undue overflow or underflow. /// - /// If z.reciprocal is non-nil, you can safely replace division by z with multiplcation by this value. It is + /// If z.reciprocal is non-nil, you can safely replace division by z with multiplication by this value. It is /// not advantageous to do this for an isolated division, but if you are dividing many values by a single /// denominator, this will often be a significant performance win. /// diff --git a/Sources/Complex/Complex.swift b/Sources/Complex/Complex.swift index 5707784..218b50d 100644 --- a/Sources/Complex/Complex.swift +++ b/Sources/Complex/Complex.swift @@ -174,7 +174,7 @@ extension Complex { /// True if this value is subnormal. /// /// A complex number is subnormal if it is finite, not normal, and not zero. When the result of a - /// computation is subnormal, underflow has occured and the result generally does not have full + /// computation is subnormal, underflow has occurred and the result generally does not have full /// precision. /// See also: /// - @@ -233,7 +233,7 @@ extension Complex { /// /// This is mainly useful for interoperation with other languages, where /// you may want to reduce each equivalence class to a single representative - /// before passing across langauge boundaries, but it may also be useful + /// before passing across language boundaries, but it may also be useful /// for some serialization tasks. It's also a useful implementation detail for /// some primitive operations. @_transparent @@ -343,7 +343,7 @@ extension Complex: Hashable { // FloatingPoint does not refine Codable, so this is a conditional conformance. extension Complex: Codable where RealType: Codable { } -// MARK: - Formating +// MARK: - Formatting extension Complex: CustomStringConvertible { public var description: String { guard isFinite else { diff --git a/Sources/Real/Real.swift b/Sources/Real/Real.swift index e1c246c..44016d7 100644 --- a/Sources/Real/Real.swift +++ b/Sources/Real/Real.swift @@ -33,7 +33,7 @@ public protocol Real: FloatingPoint, RealFunctions { // it does allow us to default the implementation of a few operations, // and also provides `signGamma`. extension Real { - // Most math libraries do not provide exp10, so we need a default impl. + // Most math libraries do not provide exp10, so we need a default implementation. @_transparent public static func exp10(_ x: Self) -> Self { return pow(10, x) diff --git a/Sources/Real/RealFunctions.swift b/Sources/Real/RealFunctions.swift index 10d4b5c..a9d6305 100644 --- a/Sources/Real/RealFunctions.swift +++ b/Sources/Real/RealFunctions.swift @@ -98,7 +98,7 @@ public protocol RealFunctions: ElementaryFunctions { /// The sign of the gamma function, Γ(x). /// /// For `x >= 0`, `signGamma(x)` is `.plus`. For negative `x`, `signGamma(x)` is `.plus` - /// when `x` is an integer, and otherwise it is `.minus` whenver `trunc(x)` is even, and `.plus` + /// when `x` is an integer, and otherwise it is `.minus` whenever `trunc(x)` is even, and `.plus` /// when `trunc(x)` is odd. /// /// This function is used together with `logGamma`, which computes the logarithm of the From 0cc4950453ab30d7015585f3dfc2eaf2579c7e19 Mon Sep 17 00:00:00 2001 From: Sajjon Date: Fri, 8 Nov 2019 08:39:27 +0100 Subject: [PATCH 2/2] Adding `MARK` in long source file --- Sources/Real/ScalarConformances.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Real/ScalarConformances.swift b/Sources/Real/ScalarConformances.swift index ffc1e14..9bb7be3 100644 --- a/Sources/Real/ScalarConformances.swift +++ b/Sources/Real/ScalarConformances.swift @@ -15,6 +15,7 @@ // and the Swift platform module are both imported (). import NumericsShims +// MARK: Float + Real extension Float: Real { @_transparent public static func cos(_ x: Float) -> Float { return libm_cosf(x) } @_transparent public static func sin(_ x: Float) -> Float { return libm_sinf(x) } @@ -68,6 +69,7 @@ extension Float: Real { #endif } +// MARK: Double + Real extension Double: Real { @_transparent public static func cos(_ x: Double) -> Double { return libm_cos(x) } @_transparent public static func sin(_ x: Double) -> Double { return libm_sin(x) } @@ -136,6 +138,7 @@ extension Double: Real { #endif } +// MARK: Float80 + Real #if (arch(i386) || arch(x86_64)) && !os(Windows) && !os(Android) extension Float80: Real { @_transparent public static func cos(_ x: Float80) -> Float80 { return libm_cosl(x) }