struct BigRational

Overview

Rational numbers are represented as the quotient of arbitrarily large numerators and denominators. Rationals are canonicalized such that the denominator and the numerator have no common factors, and that the denominator is positive. Zero has the unique representation 0/1.

NOTE To use BigRational, you must explicitly import it with require "big"

require "big"

r = BigRational.new(7.to_big_i, 3.to_big_i)
r.to_s # => "7/3"

r = BigRational.new(3, -9)
r.to_s # => "-1/3"

It is implemented under the hood with GMP.

Included Modules

Defined in:

z3/core_ext.cr

Instance Method Summary

Instance Method Detail

def !=(other : Z3::RealExpr) #

[View source]
def *(other : Z3::RealExpr) #

[View source]
def +(other : Z3::RealExpr) #

[View source]
def -(other : Z3::RealExpr) #

[View source]
def /(other : Z3::RealExpr) #

[View source]
def <(other : Z3::RealExpr) #

[View source]
def <=(other : Z3::RealExpr) #

[View source]
def ==(other : Z3::RealExpr) #

[View source]
def >(other : Z3::RealExpr) #

[View source]
def >=(other : Z3::RealExpr) #

[View source]