Update empty characters
This commit is contained in:
parent
87e4789625
commit
9004c5f553
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue