TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Wagner Truppel.
WTBinaryFloatingPointExtensions adds to all floating point types conforming to the BinaryFloatingPoint
protocol some commonly used trigonometry-related computed properties, conversions between degrees and radians, and functions to generate uniformly distributed (pseudo) random values. Here’s the full set of API additions:
public enum WTBinaryFloatingPointExtensionsError : Error
{
case allArgumentsAreZero
}
public static var piOver4: Self { get }
public static var piOver2: Self { get }
public static var threePiOver2: Self { get }
public static var twoPi: Self { get }
public var radiansInDegrees: Self { get }
public var degreesInRadians: Self { get }
public static var random01: Self { get }
public static func random(_ a: Self, _ b: Self) -> Self
public static func randomNonZero(_ a: Self, _ b: Self) throws -> Self
Because I find myself using those quite often and they are missing from the default implementations of the floating point types.
WTBinaryFloatingPointExtensions adds 9 extensions, all fully tested by 14 tests with 100% coverage.
Changes to WTBinaryFloatingPointExtensions are listed here.
WTBinaryFloatingPointExtensions is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "WTBinaryFloatingPointExtensions"
Wagner Truppel, [email protected]
WTBinaryFloatingPointExtensions is available under the MIT license. See the LICENSE file for more info.