TM-SGNL-iOS/SignalServiceKit/Util/Decimal+IsInteger.swift
TeleMessage developers dde0620daf initial commit
2025-05-03 12:28:28 -07:00

15 lines
344 B
Swift

//
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
import Foundation
public extension Decimal {
/// Is this decimal a whole number?
///
/// - Returns: `true` if the value is a whole number, `false` otherwise.
var isInteger: Bool {
(isZero || isNormal) && rounded() == self
}
}