Skip to content

Commit fe516e5

Browse files
committed
Added utility properties
1 parent d07a7cb commit fe516e5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/// ----------------------------------------------
2+
/// ----------------------------------------------
3+
/// OTCore/Extensions/Swift/FloatingPoint.swift
4+
///
5+
/// Borrowed from OTCore 1.4.14 under MIT license.
6+
/// https://github.com/orchetect/OTCore
7+
/// Methods herein are unit tested at their source
8+
/// so no unit tests are necessary.
9+
/// ----------------------------------------------
10+
/// ----------------------------------------------
11+
12+
#if canImport(Foundation)
13+
14+
import Foundation
15+
16+
// MARK: - Digit Places
17+
18+
extension Double {
19+
/// **OTCore:**
20+
/// Returns the number of digit places of the ``integral`` portion (left of the decimal).
21+
var integralDigitPlaces: Int {
22+
Decimal(self).integralDigitPlaces
23+
}
24+
25+
/// **OTCore:**
26+
/// Returns the number of digit places of the ``fraction`` portion (right of the decimal).
27+
var fractionDigitPlaces: Int {
28+
Decimal(self).fractionDigitPlaces
29+
}
30+
}
31+
32+
#endif

0 commit comments

Comments
 (0)