Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
pysel committed Sep 4, 2023
1 parent 04baa70 commit 756288c
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions osmomath/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ func init() {
precisionMultipliers[i] = calcPrecisionMultiplier(int64(i))
}

<<<<<<< HEAD
precisionDiffFromSDKDec = Precision - sdk.Precision
=======
precisionDiffFromSDKDec = PrecisionBigDec - sdk.Precision
>>>>>>> 0f295f2cdff4be4e9b34d437faf82d4d7c93c4be
if precisionDiffFromSDKDec < 0 {
panic("invalid decimal precision")
}
Expand Down Expand Up @@ -567,9 +563,6 @@ func (d BigDec) MustFloat64() float64 {

// Dec returns the osmomath.Dec representation of a BigDec.
// Values in any additional decimal places are truncated.
<<<<<<< HEAD
func (d BigDec) SDKDec() sdk.Dec {
=======
func (d BigDec) Dec() Dec {
return d.DecWithPrecision(sdk.Precision)
}
Expand All @@ -584,18 +577,13 @@ func (d BigDec) DecWithPrecision(precision int64) Dec {
precisionFactor = new(big.Int).Exp(big.NewInt(10), big.NewInt(precisionDiff), nil)
}

>>>>>>> 0f295f2cdff4be4e9b34d437faf82d4d7c93c4be
// Truncate any additional decimal values that exist due to BigDec's additional precision
// This relies on big.Int's Quo function doing floor division
intRepresentation := new(big.Int).Quo(d.BigInt(), precisionFactorSDK)

// convert int representation back to SDK Dec precision
<<<<<<< HEAD
truncatedDec := sdk.NewDecFromBigIntWithPrec(intRepresentation, sdk.Precision)
=======
truncatedDec := NewDecFromBigIntWithPrec(intRepresentation, precision)

>>>>>>> 0f295f2cdff4be4e9b34d437faf82d4d7c93c4be
return truncatedDec
}

Expand Down

0 comments on commit 756288c

Please sign in to comment.