struct Int
pub struct Int {
pub neg bool
pub abs []int
}Purpose
Structure encapsulating neg, abs.
Public fields
negbool- field (bool)
abs[]int- field ([]int)
#math/bigBig Int and rational Rat. No Float.
struct Intpub struct Int {
pub neg bool
pub abs []int
}Structure encapsulating neg, abs.
neg boolabs []intnew_intpub fn new_int(x int) IntConstruct int.
x intInt — a value of this type
($&Int) set_int64pub fn (z $&Int) set_int64(x int)Operation on $&Int: set int64.
z $&IntInt instance used by this call (exclusive borrow).x intThis call does not return a value.
($&Int) setpub fn (z $&Int) set(x &Int)Execute set on $&Int.
z $&IntInt instance used by this call (exclusive borrow).x &IntThis call does not return a value.
($&Int) set_bytespub fn (z $&Int) set_bytes(buf string)Operation on $&Int: set bytes.
z $&IntInt instance used by this call (exclusive borrow).buf stringThis call does not return a value.
($&Int) set_stringpub fn (z $&Int) set_string(s string, base0 int) intOperation on $&Int: set string. Throws on failure; handle the error or propagate it to the caller.
z $&IntInt instance used by this call (exclusive borrow).s stringbase0 intint — a value of this type
(&Int) signpub fn (z &Int) sign() intOperation on &Int: compute digital signature using private key.
z &IntInt instance used by this call (borrow).int — a value of this type
(&Int) cmppub fn (z &Int) cmp(y &Int) intExecute cmp on &Int.
z &IntInt instance used by this call (borrow).y &Intint — a value of this type
(&Int) bit_lenpub fn (z &Int) bit_len() intOperation on &Int: bit len.
z &IntInt instance used by this call (borrow).int — a value of this type
(&Int) bitpub fn (z &Int) bit(i int) intExecute bit on &Int.
z &IntInt instance used by this call (borrow).i intint — a value of this type
(&Int) bytespub fn (z &Int) bytes() stringOperation on &Int: return the buffered bytes.
z &IntInt instance used by this call (borrow).string — result string
(&Int) textpub fn (z &Int) text() stringOperation on &Int: return the current text.
z &IntInt instance used by this call (borrow).string — result string
(&Int) int64pub fn (z &Int) int64() intExecute int64 on &Int.
z &IntInt instance used by this call (borrow).int — a value of this type
($&Int) addpub fn (z $&Int) add(x &Int, y &Int)Operation on $&Int: add.
z $&IntInt instance used by this call (exclusive borrow).x &Inty &IntThis call does not return a value.
($&Int) subpub fn (z $&Int) sub(x &Int, y &Int)Operation on $&Int: subtract.
z $&IntInt instance used by this call (exclusive borrow).x &Inty &IntThis call does not return a value.
($&Int) mulpub fn (z $&Int) mul(x &Int, y &Int)Operation on $&Int: multiply.
z $&IntInt instance used by this call (exclusive borrow).x &Inty &IntThis call does not return a value.
($&Int) negpub fn (z $&Int) neg(x &Int)Execute neg on $&Int.
z $&IntInt instance used by this call (exclusive borrow).x &IntThis call does not return a value.
($&Int) abspub fn (z $&Int) abs(x &Int)Operation on $&Int: absolute value.
z $&IntInt instance used by this call (exclusive borrow).x &IntThis call does not return a value.
($&Int) lshpub fn (z $&Int) lsh(x &Int, n int)Execute lsh on $&Int.
z $&IntInt instance used by this call (exclusive borrow).x &Intn intThis call does not return a value.
($&Int) rshpub fn (z $&Int) rsh(x &Int, n int)Execute rsh on $&Int.
z $&IntInt instance used by this call (exclusive borrow).x &Intn intThis call does not return a value.
($&Int) quo_rempub fn (z $&Int) quo_rem(x &Int, y &Int, r $&Int) intOperation on $&Int: quo rem. Throws on failure; handle the error or propagate it to the caller.
z $&IntInt instance used by this call (exclusive borrow).x &Inty &Intr $&Intint — a value of this type
($&Int) quopub fn (z $&Int) quo(x &Int, y &Int) intExecute quo on $&Int. Throws on failure; handle the error or propagate it to the caller.
z $&IntInt instance used by this call (exclusive borrow).x &Inty &Intint — a value of this type
($&Int) rempub fn (z $&Int) rem(x &Int, y &Int) intExecute rem on $&Int. Throws on failure; handle the error or propagate it to the caller.
z $&IntInt instance used by this call (exclusive borrow).x &Inty &Intint — a value of this type
($&Int) modpub fn (z $&Int) mod(x &Int, m &Int) intOperation on $&Int: compute floating-point division remainder. Throws on failure; handle the error or propagate it to the caller.
z $&IntInt instance used by this call (exclusive borrow).x &Intm &Intint — a value of this type
($&Int) exppub fn (z $&Int) exp(x &Int, y &Int, m &Int) intOperation on $&Int: e to the power. Throws on failure; handle the error or propagate it to the caller.
z $&IntInt instance used by this call (exclusive borrow).x &Inty &Intm &Intint — a value of this type
($&Int) gcdpub fn (z $&Int) gcd(a &Int, b &Int)Execute gcd on $&Int.
z $&IntInt instance used by this call (exclusive borrow).a &Intb &IntThis call does not return a value.
($&Int) mod_inversepub fn (z $&Int) mod_inverse(g &Int, n &Int) intOperation on $&Int: mod inverse. Throws on failure; handle the error or propagate it to the caller.
z $&IntInt instance used by this call (exclusive borrow).g &Intn &Intint — a value of this type
(&Int) probably_primepub fn (x &Int) probably_prime(nchecks int) boolOperation on &Int: probably prime.
x &IntInt instance used by this call (borrow).nchecks intbool — true or false
struct Ratpub struct Rat {
}Rat context or state structure.
This type has no public fields.
new_ratpub fn new_rat(a int, b int) RatConstruct rat.
a intb intRat — a value of this type
($&Rat) set_fracpub fn (z $&Rat) set_frac(a &Int, b &Int) intOperation on $&Rat: set frac. Throws on failure; handle the error or propagate it to the caller.
z $&RatRat instance used by this call (exclusive borrow).a &Intb &Intint — a value of this type
(&Rat) numpub fn (z &Rat) num() IntExecute num on &Rat.
z &RatRat instance used by this call (borrow).Int — a value of this type
(&Rat) denompub fn (z &Rat) denom() IntExecute denom on &Rat.
z &RatRat instance used by this call (borrow).Int — a value of this type
(&Rat) signpub fn (z &Rat) sign() intOperation on &Rat: compute digital signature using private key.
z &RatRat instance used by this call (borrow).int — a value of this type
($&Rat) addpub fn (z $&Rat) add(x &Rat, y &Rat)Operation on $&Rat: add.
z $&RatRat instance used by this call (exclusive borrow).x &Raty &RatThis call does not return a value.
($&Rat) subpub fn (z $&Rat) sub(x &Rat, y &Rat)Operation on $&Rat: subtract.
z $&RatRat instance used by this call (exclusive borrow).x &Raty &RatThis call does not return a value.
($&Rat) mulpub fn (z $&Rat) mul(x &Rat, y &Rat)Operation on $&Rat: multiply.
z $&RatRat instance used by this call (exclusive borrow).x &Raty &RatThis call does not return a value.
($&Rat) quopub fn (z $&Rat) quo(x &Rat, y &Rat) intExecute quo on $&Rat. Throws on failure; handle the error or propagate it to the caller.
z $&RatRat instance used by this call (exclusive borrow).x &Raty &Ratint — a value of this type
const TO_ZEROpub const TO_ZERO = 0Constant TO_ZERO, defining protocol or algorithm parameters.
const TO_NEAREST_EVENpub const TO_NEAREST_EVEN = 1Constant TO_NEAREST_EVEN, defining protocol or algorithm parameters.
const TO_NEG_INFpub const TO_NEG_INF = 2Constant TO_NEG_INF, defining protocol or algorithm parameters.
const TO_POS_INFpub const TO_POS_INF = 3Constant TO_POS_INF, defining protocol or algorithm parameters.
const AWAY_FROM_ZEROpub const AWAY_FROM_ZERO = 4Constant AWAY_FROM_ZERO, defining protocol or algorithm parameters.
struct Floatpub struct Float {
pub prec int
pub neg bool
pub mant Int
pub exp int
pub form int
pub mode int
}Structure encapsulating prec, neg, mant, exp, form.
prec intneg boolmant Intexp intform intmode intnew_floatpub fn new_float() FloatConstruct float.
No arguments are required.
Float — a value of this type
($&Float) set_precpub fn (z $&Float) set_prec(p int)Operation on $&Float: set prec.
z $&FloatFloat instance used by this call (exclusive borrow).p intThis call does not return a value.
(&Float) precisionpub fn (z &Float) precision() intExecute precision on &Float.
z &FloatFloat instance used by this call (borrow).int — a value of this type
($&Float) set_modepub fn (z $&Float) set_mode(m int)Operation on $&Float: set mode.
z $&FloatFloat instance used by this call (exclusive borrow).m intThis call does not return a value.
(&Float) roundingpub fn (z &Float) rounding() intExecute rounding on &Float.
z &FloatFloat instance used by this call (borrow).int — a value of this type
($&Float) set_infpub fn (z $&Float) set_inf(neg bool)Operation on $&Float: set inf.
z $&FloatFloat instance used by this call (exclusive borrow).neg boolThis call does not return a value.
($&Float) set_nanpub fn (z $&Float) set_nan()Operation on $&Float: set nan.
z $&FloatFloat instance used by this call (exclusive borrow).This call does not return a value.
(&Float) is_infpub fn (z &Float) is_inf() boolOperation on &Float: whether the value is infinity.
z &FloatFloat instance used by this call (borrow).bool — true or false
(&Float) is_nanpub fn (z &Float) is_nan() boolOperation on &Float: whether the value is NaN.
z &FloatFloat instance used by this call (borrow).bool — true or false
($&Float) setpub fn (z $&Float) set(x &Float)Execute set on $&Float.
z $&FloatFloat instance used by this call (exclusive borrow).x &FloatThis call does not return a value.
($&Float) set_int64pub fn (z $&Float) set_int64(x int)Operation on $&Float: set int64.
z $&FloatFloat instance used by this call (exclusive borrow).x intThis call does not return a value.
($&Float) set_intpub fn (z $&Float) set_int(x &Int)Operation on $&Float: set int.
z $&FloatFloat instance used by this call (exclusive borrow).x &IntThis call does not return a value.
(&Float) to_int64pub fn (z &Float) to_int64() intOperation on &Float: convert to int64. Throws on failure; handle the error or propagate it to the caller.
z &FloatFloat instance used by this call (borrow).int — a value of this type
(&Float) signbitpub fn (z &Float) signbit() boolExecute signbit on &Float.
z &FloatFloat instance used by this call (borrow).bool — true or false
(&Float) unbiased_exppub fn (z &Float) unbiased_exp() intOperation on &Float: unbiased exp.
z &FloatFloat instance used by this call (borrow).int — a value of this type
(&Float) mantissapub fn (z &Float) mantissa() FloatExecute mantissa on &Float.
z &FloatFloat instance used by this call (borrow).Float — a value of this type
($&Float) set_mant_exppub fn (z $&Float) set_mant_exp(mant &Float, exp int)Operation on $&Float: set mant exp.
z $&FloatFloat instance used by this call (exclusive borrow).mant &Floatexp intThis call does not return a value.
(&Float) signpub fn (z &Float) sign() intOperation on &Float: compute digital signature using private key.
z &FloatFloat instance used by this call (borrow).int — a value of this type
(&Float) cmppub fn (z &Float) cmp(y &Float) intExecute cmp on &Float. Throws on failure; handle the error or propagate it to the caller.
z &FloatFloat instance used by this call (borrow).y &Floatint — a value of this type
($&Float) addpub fn (z $&Float) add(x &Float, y &Float)Operation on $&Float: add.
z $&FloatFloat instance used by this call (exclusive borrow).x &Floaty &FloatThis call does not return a value.
($&Float) subpub fn (z $&Float) sub(x &Float, y &Float)Operation on $&Float: subtract.
z $&FloatFloat instance used by this call (exclusive borrow).x &Floaty &FloatThis call does not return a value.
($&Float) mulpub fn (z $&Float) mul(x &Float, y &Float)Operation on $&Float: multiply.
z $&FloatFloat instance used by this call (exclusive borrow).x &Floaty &FloatThis call does not return a value.
($&Float) quopub fn (z $&Float) quo(x &Float, y &Float) intExecute quo on $&Float. Throws on failure; handle the error or propagate it to the caller.
z $&FloatFloat instance used by this call (exclusive borrow).x &Floaty &Floatint — a value of this type
(&Float) textpub fn (z &Float) text() stringOperation on &Float: return the current text.
z &FloatFloat instance used by this call (borrow).string — result string
($&Float) set_stringpub fn (z $&Float) set_string(s string) intOperation on $&Float: set string. Throws on failure; handle the error or propagate it to the caller.
z $&FloatFloat instance used by this call (exclusive borrow).s stringint — a value of this type
($&Float) set_float64pub fn (z $&Float) set_float64(x f64) intOperation on $&Float: set float64.
z $&FloatFloat instance used by this call (exclusive borrow).x f64int — a value of this type