Rename RationalRoundingRule to RoundingRule

This commit is contained in:
Xiaodi Wu 2017-05-07 04:23:40 -05:00
parent abbb554d2c
commit 0f1fb6cb2b
3 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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