Show / Hide Table of Contents

    Struct Rat

    A rational number, i.e. a fraction of arbitrary precision.

    Implements
    System.IComparable
    System.IComparable<Rat>
    System.IEquatable<Rat>
    Namespace: Tensor.Algorithm
    Assembly: Tensor.Algorithm.dll
    Syntax
    [<Struct; CustomEquality; CustomComparison>]
    type Rat
        inherit ValueType
        interface IComparable
        interface IComparable<Rat>
        interface IEquatable<Rat>

    Constructors

    Name Description
    new: int32 * int32 -> Rat

    Constructs a fraction from numerator and denominator.

    new: int32 -> Rat

    Constructs an integer rational number.

    new: int64 * int64 -> Rat

    Constructs a fraction from numerator and denominator.

    new: int64 -> Rat

    Constructs an integer rational number.

    new: BigInteger * BigInteger -> Rat

    Constructs a fraction from numerator and denominator.

    new: BigInteger -> Rat

    Constructs an integer rational number.

    new: uint32 * uint32 -> Rat

    Constructs a fraction from numerator and denominator.

    new: uint32 -> Rat

    Constructs an integer rational number.

    new: uint64 * uint64 -> Rat

    Constructs a fraction from numerator and denominator.

    new: uint64 -> Rat

    Constructs an integer rational number.

    Fields

    Name Description
    val Num: bigint

    the numerator

    Properties

    Name Description
    property Dnm: bigint

    the denominator

    property IsFinite: bool

    True if this is a finite number (not infinity and not NaN).

    property IsInf: bool

    True is this is infinity.

    property IsInt: bool

    True if this is an integer, i.e. denominator is one.

    property IsNaN: bool

    True if this is not-a-number.

    property IsNegInf: bool

    True is this is negative infinity.

    property IsPosInf: bool

    True is this is positive infinity.

    static property MaxValue: Rat
    static property MinusOne: Rat
    static property MinValue: Rat
    static property NaN: Rat
    static property NegInf: Rat
    static property One: Rat
    static property PosInf: Rat
    property Pretty: string

    Pretty string representation.

    static property Zero: Rat

    Methods

    Name Description
    static member Abs: Rat -> Rat
    static member Ceiling: Rat -> Rat
    static member dnm: Rat -> bigint

    denominator

    override member Equals: obj -> bool
    static member Floor: Rat -> Rat
    static member get_Sign: Rat -> int
    override member GetHashCode: unit -> int
    static member isFinite: Rat -> bool

    True if a is a finite number.

    static member isInf: Rat -> bool

    True if a is infinity.

    static member isInteger: Rat -> bool

    True if a is an integer, i.e. its denominator is one.

    static member isNaN: Rat -> bool

    True if a is not-a-number.

    static member isNegInf: Rat -> bool

    True if a is negative infinity.

    static member isPosInf: Rat -> bool

    True if a is positive infinity.

    static member num: Rat -> bigint

    numerator

    override member ToString: unit -> string
    static member Truncate: Rat -> Rat

    Operators

    Name Description
    static member ( + ): Rat * Rat -> Rat
    static member ( / ): Rat * Rat -> Rat
    static member op_Explicit: Rat -> bigint
    static member op_Explicit: Rat -> double
    static member op_Explicit: Rat -> int32
    static member op_Explicit: Rat -> int64
    static member op_Explicit: Rat -> single
    static member op_Explicit: Rat -> uint32
    static member op_Explicit: Rat -> uint64
    static member op_Implicit: bigint -> Rat
    static member op_Implicit: int32 -> Rat
    static member op_Implicit: int64 -> Rat
    static member op_Implicit: uint32 -> Rat
    static member op_Implicit: uint64 -> Rat
    static member ( % ): Rat * Rat -> Rat
    static member ( * ): Rat * Rat -> Rat
    static member ( - ): Rat * Rat -> Rat
    static member ( ~- ): Rat -> Rat
    static member ( ~+ ): Rat -> Rat

    Explicit Interface Implementations

    Name Description
    interface IComparable<Rat> with member CompareTo: Rat -> int
    interface IComparable with member CompareTo: obj -> int
    interface IEquatable<Rat> with member Equals: Rat -> bool
    Back to top Generated by DocFX