MCPcopy Create free account
hub / github.com/DOSNetwork/core / SetString

Method SetString

group/mod/int.go:121–134  ·  view source on GitHub ↗

SetString sets the Int to a rational fraction n/d represented by a pair of strings. If d == "", then the denominator is taken to be 1. Returns (i,true) on success, or (nil,false) if either string fails to parse.

(n, d string, base int)

Source from the content-addressed store, hash-verified

119// Returns (i,true) on success, or
120// (nil,false) if either string fails to parse.
121func (i *Int) SetString(n, d string, base int) (*Int, bool) {
122 if _, succ := i.V.SetString(n, base); !succ {
123 return nil, false
124 }
125 if d != "" {
126 var di Int
127 di.M = i.M
128 if _, succ := di.SetString(d, "", base); !succ {
129 return nil, false
130 }
131 i.Div(i, &di)
132 }
133 return i, true
134}
135
136// Cmp compares two Ints for equality or inequality
137func (i *Int) Cmp(s2 kyber.Scalar) int {

Callers 8

InitStringMethod · 0.95
const.goFile · 0.80
bigFromBase10Function · 0.80
NewBlakeSHA256QR512Function · 0.80
genGroupFunction · 0.80
onchainLoopMethod · 0.80
handleCRMethod · 0.80
GetBalanceFunction · 0.80

Calls 1

DivMethod · 0.95

Tested by

no test coverage detected