Rational
public struct Rational
extension Rational: CustomStringConvertible
extension Rational: Hashable
Swift representation of a rational number
-
Numerator part. Carries the sign of the rational number
Declaration
Swift
public let numerator: Int
-
Denominator part
Declaration
Swift
public let denominator: Int
-
Errors throwed by
See moreRational(numerator:denominator:)
Declaration
Swift
public enum InitError : Error
-
Initializes a
Rational
instance settingnumerator
&denominator
with the provided parametersDeclaration
Swift
public init(numerator: Int, denominator: Int) throws
-
Constant: 0/1
Declaration
Swift
public static let zero: Rational
-
Declaration
Swift
public var description: String { get }