Logo

Programming-Idioms

Initialize a quotient q = a/b of arbitrary precision. a and b are large integers.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import "math/big"
q := new(big.Rat)
q.SetString(str)
import "math/big"
q := new(big.Rat)
q.SetFrac(a, b)
import "math/big"
q := big.NewRat(a, b)
import fractions
q = fractions.Fraction(a, b)
q = Rational(a, b)