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)
| 119 | // Returns (i,true) on success, or |
| 120 | // (nil,false) if either string fails to parse. |
| 121 | func (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 |
| 137 | func (i *Int) Cmp(s2 kyber.Scalar) int { |
no test coverage detected