MCPcopy Create free account
hub / github.com/Masterminds/sprig / execDecimalOp

Function execDecimalOp

numeric.go:178–186  ·  view source on GitHub ↗

performs a float and subsequent decimal.Decimal conversion on inputs, and iterates through a and b executing the mathmetical operation f

(a interface{}, b []interface{}, f func(d1, d2 decimal.Decimal) decimal.Decimal)

Source from the content-addressed store, hash-verified

176// performs a float and subsequent decimal.Decimal conversion on inputs,
177// and iterates through a and b executing the mathmetical operation f
178func execDecimalOp(a interface{}, b []interface{}, f func(d1, d2 decimal.Decimal) decimal.Decimal) float64 {
179 prt := decimal.NewFromFloat(toFloat64(a))
180 for _, x := range b {
181 dx := decimal.NewFromFloat(toFloat64(x))
182 prt = f(prt, dx)
183 }
184 rslt, _ := prt.Float64()
185 return rslt
186}

Callers 1

functions.goFile · 0.85

Calls 1

toFloat64Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…