Update empty characters

This commit is contained in:
Igor Kislyuk 2018-05-22 16:41:19 +03:00
parent 87e4789625
commit 9004c5f553
2 changed files with 3 additions and 4 deletions

View File

@ -44,7 +44,7 @@ public extension Double {
func roundValue(withPrecision precision: UInt,
roundType: RoundingType = .normal) -> Double {
let divider = pow(10.0, Double(precision))
switch roundType {
case .normal:
return (self * divider).rounded(.toNearestOrEven) / divider
@ -52,6 +52,5 @@ public extension Double {
return (self * divider).rounded(.down) / divider
}
}
}
}

View File

@ -19,6 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import XCTest
class Double_RoundingTests: XCTestCase {
@ -50,5 +51,4 @@ class Double_RoundingTests: XCTestCase {
XCTAssertTrue(some.roundValue(withPrecision: 1, roundType: .down) == -1.8)
XCTAssertTrue(some.roundValue(withPrecision: 2, roundType: .down) == -1.78)
}
}