Skip to content

Commit

Permalink
Add clamped
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Feb 17, 2024
1 parent a9b96d0 commit 5ec79b6
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,31 @@ extension Decimal192: CustomStringConvertible {
}
}

extension Decimal192 {
public static let maxDivisibility: UInt = 18
}

extension Decimal192 {
public var clamped: Self {
isNegative() ? .zero : self
}
public func isNegative() -> Bool {
decimalIsNegative(decimal: self)
}
}

extension Decimal192: Comparable {
public static func > (lhs: Self, rhs: Self) -> Bool {
lhs.greaterThan(rhs)
lhs.greaterThan(other: rhs)
}
public static func < (lhs: Self, rhs: Self) -> Bool {
lhs.lessThan(rhs)
lhs.lessThan(other: rhs)
}
public static func >= (lhs: Self, rhs: Self) -> Bool {
lhs.greaterThanOrEqual(rhs)
lhs.greaterThanOrEqual(other: rhs)
}
public static func <= (lhs: Self, rhs: Self) -> Bool {
lhs.lessThanOrEqual(rhs)
lhs.lessThanOrEqual(other: rhs)
}
}
extension Decimal192 {
Expand Down

0 comments on commit 5ec79b6

Please sign in to comment.