Link Search Menu Expand Document

rational overview

A fractional number type with typeclass instances. Note: this data type shouldn’t be used for computations involving large numbers, because the lawfulness of these particular instances breaks down due to floating point error quicker than the others by the nature of reducing fractional values

Added in v1.0.0


Table of contents


Aliases

add

Signature

export declare const add: (x: Rational, y: Rational) => Rational

Added in v1.0.0

div

Signature

export declare const div: (x: Rational, y: Rational) => Rational

Added in v1.0.0

mul

Signature

export declare const mul: (x: Rational, y: Rational) => Rational

Added in v1.0.0

sub

Signature

export declare const sub: (x: Rational, y: Rational) => Rational

Added in v1.0.0

Constructors

fromInt

Signature

export declare const fromInt: (top: Int.Int) => Rational

Added in v1.0.0

of

Signature

export declare const of: (top: Int.Int, bottom: Int.Int) => O.Option<Rational>

Added in v1.0.0

one

Signature

export declare const one: Rational

Added in v1.0.0

randRational

Signature

export declare const randRational: (low: number, high: number) => IO.IO<Rational>

Added in v1.0.0

zero

Signature

export declare const zero: Rational

Added in v1.0.0

Destructors

toNumber

Signature

export declare const toNumber: (r: Rational) => number

Added in v1.0.0

Infix

$_

Signature

export declare const $_: (s: Inf.FieldSymbol, x: Rational, y: Rational) => Rational

Added in v1.0.0

_

Signature

export declare const _: (a: Rational, s: Inf.FieldSymbol, b: Rational) => Rational

Added in v1.0.0

_$

Signature

export declare const _$: (a: Rational, b: Rational, s: Inf.FieldSymbol) => Rational

Added in v1.0.0

Instances

AdditiveAbGrpMN

Signature

export declare const AdditiveAbGrpMN: <M, N>(m: M, n: N) => AbelianGroup<M.Mat<M, N, Rational>>

Added in v1.0.0

AdditiveAbGrpN

Signature

export declare const AdditiveAbGrpN: <N>(n: N) => AbelianGroup<V.Vec<N, Rational>>

Added in v1.0.0

BiModMN

Signature

export declare const BiModMN: <M, N>(m: M, n: N) => Bimodule<M.Mat<M, N, Rational>, Rational, Rational>

Added in v1.0.0

BiModN

Signature

export declare const BiModN: <N>(n: N) => Bimodule<V.Vec<N, Rational>, Rational, Rational>

Added in v1.0.0

Bounded

Signature

export declare const Bounded: Bnd.Bounded<Rational>

Added in v1.0.0

Eq

Signature

export declare const Eq: Eq_.Eq<Rational>

Added in v1.0.0

Field

Adapted from Purescript: https://github.com/purescript/purescript-prelude/blob/v6.0.0/src/Data/EuclideanRing.js

Signature

export declare const Field: Fld.Field<Rational>

Added in v1.0.0

MagmaSub

Signature

export declare const MagmaSub: Mg.Magma<Rational>

Added in v1.0.0

MonoidProduct

Signature

export declare const MonoidProduct: Mn.Monoid<Rational>

Added in v1.0.0

MonoidSum

Signature

export declare const MonoidSum: Mn.Monoid<Rational>

Added in v1.0.0

Ord

Signature

export declare const Ord: Ord_.Ord<Rational>

Added in v1.0.0

SemigroupProduct

Signature

export declare const SemigroupProduct: Sg.Semigroup<Rational>

Added in v1.0.0

SemigroupSum

Signature

export declare const SemigroupSum: Sg.Semigroup<Rational>

Added in v1.0.0

Show

Signature

export declare const Show: Sh.Show<Rational>

Added in v1.0.0

Model

Mat (type alias)

Signature

export type Mat<M, N> = M.Mat<M, N, Rational>

Added in v1.0.0

Rational (interface)

Signature

export interface Rational {
  readonly _URI: RationalSymbol
  readonly top: Int.Int
  readonly bottom: Int.Int
}

Added in v1.0.0

Vec (type alias)

Signature

export type Vec<N> = V.Vec<N, Rational>

Added in v1.0.0

Rational Ops

abs

Signature

export declare const abs: (a: Rational) => Rational

Added in v1.0.0