MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / findLargestDecimal

Function findLargestDecimal

model/transaction.go:259–269  ·  view source on GitHub ↗

findLargestDecimal finds the key with the largest decimal value

(amounts map[string]decimal.Decimal)

Source from the content-addressed store, hash-verified

257
258// findLargestDecimal finds the key with the largest decimal value
259func findLargestDecimal(amounts map[string]decimal.Decimal) (string, decimal.Decimal) {
260 var largestKey string
261 var largestAmount decimal.Decimal
262 for id, amount := range amounts {
263 if amount.Cmp(largestAmount) > 0 {
264 largestAmount = amount
265 largestKey = id
266 }
267 }
268 return largestKey, largestAmount
269}
270
271// combineDistributions merges fixed and percentage amounts into the result
272func combineDistributions(state *distributionState) {

Callers 2

TestFindLargestDecimalFunction · 0.85
adjustPercentageAmountsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFindLargestDecimalFunction · 0.68