MCPcopy
hub / github.com/shopspring/decimal / Abs

Method Abs

decimal.go:513–523  ·  view source on GitHub ↗

Abs returns the absolute value of the decimal.

()

Source from the content-addressed store, hash-verified

511
512// Abs returns the absolute value of the decimal.
513func (d Decimal) Abs() Decimal {
514 if !d.IsNegative() {
515 return d
516 }
517 d.ensureInitialized()
518 d2Value := new(big.Int).Abs(d.value)
519 return Decimal{
520 value: d2Value,
521 exp: d.exp,
522 }
523}
524
525// Add returns d + d2.
526func (d Decimal) Add(d2 Decimal) Decimal {

Callers 15

PowMethod · 0.95
PowWithPrecisionMethod · 0.95
ExpHullAbrhamMethod · 0.95
ExpTaylorMethod · 0.95
LnMethod · 0.95
TestDecimal_QuoRemFunction · 0.80
TestDecimal_QuoRem2Function · 0.80
TestDecimal_DivRoundFunction · 0.80
TestDecimal_DivRound2Function · 0.80
TestDecimal_Abs1Function · 0.80
TestDecimal_Abs2Function · 0.80

Calls 2

IsNegativeMethod · 0.95
ensureInitializedMethod · 0.95

Tested by 7

TestDecimal_QuoRemFunction · 0.64
TestDecimal_QuoRem2Function · 0.64
TestDecimal_DivRoundFunction · 0.64
TestDecimal_DivRound2Function · 0.64
TestDecimal_Abs1Function · 0.64
TestDecimal_Abs2Function · 0.64