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 {
|
extension Rational {
|
||||||
/// Returns the quotient obtained by dividing the first value by the second,
|
/// Returns the quotient obtained by dividing the first value by the second,
|
||||||
/// trapping in case of arithmetic overflow.
|
/// trapping in case of arithmetic overflow.
|
||||||
|
@ -171,7 +169,7 @@ extension Rational {
|
||||||
/// - SeeAlso: `round(_:)`, `FloatingPointRoundingRule`
|
/// - SeeAlso: `round(_:)`, `FloatingPointRoundingRule`
|
||||||
@_transparent // @_inlineable
|
@_transparent // @_inlineable
|
||||||
public func rounded(
|
public func rounded(
|
||||||
_ rule: RationalRoundingRule = .toNearestOrAwayFromZero
|
_ rule: RoundingRule = .toNearestOrAwayFromZero
|
||||||
) -> Rational {
|
) -> Rational {
|
||||||
var t = self
|
var t = self
|
||||||
t.round(rule)
|
t.round(rule)
|
||||||
|
@ -202,9 +200,7 @@ extension Rational {
|
||||||
///
|
///
|
||||||
/// - SeeAlso: `round(_:)`, `FloatingPointRoundingRule`
|
/// - SeeAlso: `round(_:)`, `FloatingPointRoundingRule`
|
||||||
@_transparent // @_inlineable
|
@_transparent // @_inlineable
|
||||||
public mutating func round(
|
public mutating func round(_ rule: RoundingRule = .toNearestOrAwayFromZero) {
|
||||||
_ rule: RationalRoundingRule = .toNearestOrAwayFromZero
|
|
||||||
) {
|
|
||||||
if denominator == 0 { return }
|
if denominator == 0 { return }
|
||||||
|
|
||||||
let f: T
|
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.
|
// 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
|
public typealias Sign = FloatingPointSign
|
||||||
|
|
Loading…
Reference in New Issue