func (d Decimal) Cmp(other Decimal) int {
	if anyNan(d, other) {
		return 0
	}
	return d.fl.Cmp(other.fl)
}
Cmp will return 1 if this decimal is greater than the provided, 0 if they are the same, and -1 if it is less.
package big
import (
	"database/sql/driver"
	"encoding/json"
	"errors"
	"fmt"
	"math"
	"math/big"
)
var (
	flZero = *big.NewFloat(0)
	NaN = NewDecimal(math.NaN())
	ZERO = NewFromString("0")
	ONE = NewFromString("1")
	TEN = NewFromString("10")
	MarshalQuoted = false
)
type Decimal struct {
	fl *big.Float
}
func NewDecimal(val float64) Decimal {
	var fl *big.Float
	defer func() {
		if r := recover(); r != nil {
			switch r.(type) {
			case big.ErrNaN:
				fl = nil
			}
		}
	}()
	fl = big.NewFloat(val)
	return Decimal{
		fl: fl,
	}
}
func NewFromString(str string) Decimal {
	bfl := big.NewFloat(0)
	if _, _, err := bfl.Parse(str, 10); err != nil {
		return NaN
	}
	return Decimal{bfl}
}
func NewFromInt(dec int) Decimal {
	return Decimal{big.NewFloat(float64(dec))}
}
func MaxSlice(decimals ...Decimal) Decimal {
	if anyNan(decimals...) {
		return NaN
	} else if len(decimals) == 0 {
		return ZERO
	}
	initial := NewFromString("-Inf")
	for _, decimal := range decimals {
		if decimal.GT(initial) {
			initial = decimal
		}
	}
	return initial
}
func MinSlice(decimals ...Decimal) Decimal {
	if anyNan(decimals...) {
		return NaN
	} else if len(decimals) == 0 {
		return ZERO
	}
	initial := NewFromString("Inf")
	for _, decimal := range decimals {
		if decimal.LT(initial) {
			initial = decimal
		}
	}
	return initial
}
func (d Decimal) Add(addend Decimal) Decimal {
	return nanGuard(func() Decimal {
		return Decimal{d.cpy().Add(d.fl, addend.fl)}
	}, d, addend)
}
func (d Decimal) Sub(subtrahend Decimal) Decimal {
	return nanGuard(func() Decimal {
		return Decimal{d.cpy().Sub(d.fl, subtrahend.fl)}
	}, d, subtrahend)
}
func (d Decimal) Mul(factor Decimal) Decimal {
	return nanGuard(func() Decimal {
		return Decimal{d.cpy().Mul(d.fl, factor.fl)}
	}, d, factor)
}
func (d Decimal) Div(denominator Decimal) Decimal {
	return nanGuard(func() Decimal {
		return Decimal{d.cpy().Quo(d.fl, denominator.fl)}
	}, d, denominator)
}
func (d Decimal) Frac(f float64) Decimal {
	fractionFactor := NewDecimal(f)
	return nanGuard(func() Decimal {
		return d.Mul(NewDecimal(f))
	}, d, fractionFactor)
}
func (d Decimal) Neg() Decimal {
	return nanGuard(func() Decimal {
		return d.Mul(NewDecimal(-1))
	}, d)
}
func (d Decimal) Abs() Decimal {
	if d.LT(ZERO) {
		return d.Mul(ONE.Neg())
	}
	return d
}
func (d Decimal) Pow(exp int) Decimal {
	return nanGuard(func() Decimal {
		if exp == 0 {
			return ONE
		}
		x := Decimal{d.cpy()}
		for i := 1; i < exp; i++ {
			x = x.Mul(d)
		}
		return x
	}, d)
}
func (d Decimal) Sqrt() Decimal {
	return nanGuard(func() Decimal {
		return Decimal{d.cpy().Sqrt(d.cpy())}
	}, d)
}
func (d Decimal) EQ(other Decimal) bool {
	if anyNan(d, other) {
		return false
	}
	return d.Cmp(other) == 0
}
func (d Decimal) LT(other Decimal) bool {
	if anyNan(d, other) {
		return false
	}
	return d.Cmp(other) < 0
}
func (d Decimal) LTE(other Decimal) bool {
	if anyNan(d, other) {
		return false
	}
	return d.Cmp(other) <= 0
}
func (d Decimal) GT(other Decimal) bool {
	if anyNan(d, other) {
		return false
	}
	return d.Cmp(other) > 0
}
func (d Decimal) GTE(other Decimal) bool {
	if anyNan(d, other) {
		return false
	}
	return d.Cmp(other) >= 0
}