<=(_:_:)
Less than or equal
static func <= (x: BFraction, y: BInt) -> Bool
Parameters
Returns
true
if x <= y, false
otherwise
Less than or equal
static func <= (x: BFraction, y: BInt) -> Bool
true
if x <= y, false
otherwise
import BigInt
Signed integers and fractions of unbounded size
struct BFraction
The BFraction structure
struct BInt
The BInt structure
@frozen struct Bool
A value type whose instances are either true
or false
.
static func == (x: BFraction, y: BFraction) -> Bool
Equal
static func == (x: BFraction, y: BInt) -> Bool
Equal
static func == (x: BInt, y: BFraction) -> Bool
Equal
static func == (x: BFraction, y: Int) -> Bool
Equal
static func == (x: Int, y: BFraction) -> Bool
Equal
static func != (x: BFraction, y: BFraction) -> Bool
Not equal
static func != (x: BFraction, y: BInt) -> Bool
Not equal
static func != (x: BInt, y: BFraction) -> Bool
Not equal
static func != (x: BFraction, y: Int) -> Bool
Not equal
static func != (x: Int, y: BFraction) -> Bool
Not equal
static func < (x: BFraction, y: BFraction) -> Bool
Less than
static func < (x: BFraction, y: BInt) -> Bool
Less than
static func < (x: BInt, y: BFraction) -> Bool
Less than
static func < (x: BFraction, y: Int) -> Bool
Less than
static func < (x: Int, y: BFraction) -> Bool
Less than
static func > (x: BFraction, y: BFraction) -> Bool
Greater than
static func > (x: BFraction, y: BInt) -> Bool
Greater than
static func > (x: BInt, y: BFraction) -> Bool
Greater than
static func > (x: BFraction, y: Int) -> Bool
Greater than
static func > (x: Int, y: BFraction) -> Bool
Greater than
static func <= (x: BFraction, y: BFraction) -> Bool
Less than or equal
static func <= (x: BInt, y: BFraction) -> Bool
Less than or equal
static func <= (x: BFraction, y: Int) -> Bool
Less than or equal
static func <= (x: Int, y: BFraction) -> Bool
Less than or equal
static func >= (x: BFraction, y: BFraction) -> Bool
Greater than or equal
static func >= (x: BFraction, y: BInt) -> Bool
Greater than or equal
static func >= (x: BInt, y: BFraction) -> Bool
Greater than or equal
static func >= (x: BFraction, y: Int) -> Bool
Greater than or equal
static func >= (x: Int, y: BFraction) -> Bool
Greater than or equal
init(_ x: [BInt])
Constructs a BFraction
from a continued fraction - BInt version
init(_ x: [Int])
Constructs a BFraction
from a continued fraction - Int version
init?(_ x: String)
Constructs a BFraction
from a String representation, nil
if x
does not represent a decimal number
init?(_ d: Double)
Constructs a BFraction
from a decimal value, nil
if d
is infinite or NaN
init(_ n: Int, _ d: BInt)
Constructs a BFraction
from numerator and denominator
init(_ n: Int, _ d: Int)
Constructs a BFraction
from numerator and denominator
init(_ n: BInt, _ d: BInt)
Constructs a BFraction
from numerator and denominator
init(_ n: BInt, _ d: Int)
Constructs a BFraction
from numerator and denominator
static let ONE: BFraction
BFraction(1, 1)
static let ZERO: BFraction
BFraction(0, 1)
static func bernoulli(_ n: Int) -> BFraction
Bernoulli number
static func bernoulliSequence(_ n: Int) -> [BFraction]
Bernoulli numbers
static func harmonic(_ n: Int) -> BFraction
Harmonic number: 1 + 1 / 2 + … + 1 / n
static func harmonicSequence(_ n: Int) -> [BFraction]
Harmonic sequence: The first n harmonic numbers
var abs: BFraction { get }
The absolute value of self
var denominator: BInt { get }
The denominator - a positive BInt
value
var description: String { get }
String value of self
var isInteger: Bool { get }
Is true
if self
is an integer, that is, the denominator is 1
var isNegative: Bool { get }
Is true
if self
< 0, false
otherwise
var isPositive: Bool { get }
Is true
if self
> 0, false
otherwise
var isZero: Bool { get }
Is true
if self
= 0, false
otherwise
var numerator: BInt { get }
The numerator - a BInt
value
var signum: Int { get }
Is 0 if self
= 0, 1 if self
> 0, and -1 if self
< 0
static func * (x: BFraction, y: BInt) -> BFraction
Multiplication
static func * (x: BFraction, y: BFraction) -> BFraction
Multiplication
static func * (x: BFraction, y: Int) -> BFraction
Multiplication
static func * (x: Int, y: BFraction) -> BFraction
Multiplication
static func * (x: BInt, y: BFraction) -> BFraction
Multiplication
static func ** (a: BFraction, x: Int) -> BFraction
Exponentiation
static func *= (x: inout BFraction, y: BInt)
x = x * y
static func *= (x: inout BFraction, y: BFraction)
x = x * y
static func *= (x: inout BFraction, y: Int)
x = x * y
static func + (x: BFraction) -> BFraction
Prefix plus
static func + (x: BFraction, y: BInt) -> BFraction
Addition
static func + (x: BFraction, y: BFraction) -> BFraction
Addition
static func + (x: BFraction, y: Int) -> BFraction
Addition
static func + (x: Int, y: BFraction) -> BFraction
Addition
static func + (x: BInt, y: BFraction) -> BFraction
Addition
static func += (x: inout BFraction, y: BInt)
x = x + y
static func += (x: inout BFraction, y: BFraction)
x = x + y
static func += (x: inout BFraction, y: Int)
x = x + y
static func - (x: BFraction) -> BFraction
Negation
static func - (x: BFraction, y: BInt) -> BFraction
Subtraction
static func - (x: BFraction, y: BFraction) -> BFraction
Subtraction
static func - (x: BFraction, y: Int) -> BFraction
Subtraction
static func - (x: Int, y: BFraction) -> BFraction
Subtraction
static func - (x: BInt, y: BFraction) -> BFraction
Subtraction
static func -= (x: inout BFraction, y: BInt)
x = x - y
static func -= (x: inout BFraction, y: BFraction)
x = x - y
static func -= (x: inout BFraction, y: Int)
x = x - y
static func / (x: BFraction, y: BInt) -> BFraction
Division
static func / (x: BFraction, y: BFraction) -> BFraction
Division
static func / (x: BFraction, y: Int) -> BFraction
Division
static func / (x: Int, y: BFraction) -> BFraction
Division
static func / (x: BInt, y: BFraction) -> BFraction
Division
static func /= (x: inout BFraction, y: BInt)
x = x / y
static func /= (x: inout BFraction, y: BFraction)
x = x / y
static func /= (x: inout BFraction, y: Int)
x = x / y
func asContinuedFraction() -> [BInt]
self
as a Continued Fraction
func asDecimalString(precision: Int, exponential: Bool = false) -> String
self
as a Decimal String with a specified precision, possibly using exponential notation
func asDouble() -> Double
self
as a Double
func asString() -> String
self
as a String
func ceil() -> BInt
Round towards +Infinity
func floor() -> BInt
Round towards -Infinity
func invert() -> BFraction
Invert self
func mod(_ m: BInt) -> BInt?
Modulus - BInt version
func mod(_ m: Int) -> Int?
Modulus - Int version
mutating func negate()
Negates self
func round() -> BInt
Round to nearest
func truncate() -> BInt
Round towards 0