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

Function floatToBigInt

model/transaction_test.go:48–54  ·  view source on GitHub ↗

Helper to convert float64 to *big.Int with precision applied

(value float64, precision int64)

Source from the content-addressed store, hash-verified

46
47// Helper to convert float64 to *big.Int with precision applied
48func floatToBigInt(value float64, precision int64) *big.Int {
49 decValue := decimal.NewFromFloat(value)
50 decPrecision := decimal.NewFromInt(precision)
51 preciseValue := decValue.Mul(decPrecision)
52
53 return preciseValue.BigInt()
54}
55
56// Helper to convert map of float64 to map of *big.Int with precision applied
57func floatMapToBigIntMap(floatMap map[string]float64, precision int64) map[string]*big.Int {

Callers 2

floatMapToBigIntMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected