github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/util/math/parse.go (about)

     1  package math
     2  
     3  import "math/big"
     4  
     5  // Parse a slice of strings (representing integers in decimal)
     6  // Convention: this function is to be applied to strings representing Q.128 fixed-point numbers, and thus returns numbers in binary Q.128 representation
     7  func Parse(coefs []string) []*big.Int {
     8  	out := make([]*big.Int, len(coefs))
     9  	for i, coef := range coefs {
    10  		c, ok := new(big.Int).SetString(coef, 10)
    11  		if !ok {
    12  			panic("could not parse q128 parameter")
    13  		}
    14  		// << 128 (Q.0 to Q.128) >> 128 to transform integer params to coefficients
    15  		out[i] = c
    16  	}
    17  	return out
    18  }