Rename RationalRoundingRule to RoundingRule
This commit is contained in:
parent
abbb554d2c
commit
0f1fb6cb2b
|
@ -126,8 +126,6 @@ extension Rational : SignedNumeric {
|
|||
}
|
||||
}
|
||||
|
||||
public typealias RationalRoundingRule = FloatingPointRoundingRule
|
||||
|
||||
extension Rational {
|
||||
/// Returns the quotient obtained by dividing the first value by the second,
|
||||
/// trapping in case of arithmetic overflow.
|
||||
|
@ -171,7 +169,7 @@ extension Rational {
|
|||
/// - SeeAlso: `round(_:)`, `FloatingPointRoundingRule`
|
||||
@_transparent // @_inlineable
|
||||
public func rounded(
|
||||
_ rule: RationalRoundingRule = .toNearestOrAwayFromZero
|
||||
_ rule: RoundingRule = .toNearestOrAwayFromZero
|
||||
) -> Rational {
|
||||
var t = self
|
||||
t.round(rule)
|
||||
|
@ -202,9 +200,7 @@ extension Rational {
|
|||
///
|
||||
/// - SeeAlso: `round(_:)`, `FloatingPointRoundingRule`
|
||||
@_transparent // @_inlineable
|
||||
public mutating func round(
|
||||
_ rule: RationalRoundingRule = .toNearestOrAwayFromZero
|
||||
) {
|
||||
public mutating func round(_ rule: RoundingRule = .toNearestOrAwayFromZero) {
|
||||
if denominator == 0 { return }
|
||||
|
||||
let f: T
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
//
|
||||
// RoundingRule.swift
|
||||
// NumericAnnex
|
||||
//
|
||||
// Created by Xiaodi Wu on 5/7/17.
|
||||
//
|
||||
|
||||
/// A rule for rounding a number.
|
||||
public typealias RoundingRule = FloatingPointRoundingRule
|
|
@ -5,5 +5,5 @@
|
|||
// Created by Xiaodi Wu on 4/30/17.
|
||||
//
|
||||
|
||||
/// A type to represent the mathematical sign of a value.
|
||||
/// The mathematical sign of a number.
|
||||
public typealias Sign = FloatingPointSign
|
||||
|
|
Loading…
Reference in New Issue