INNER CODE UNIT · Go
cmpabs
ericlagergren/decimal · big.go:499
func cmpabs(x, y *Big) int {
// Same scales means we can compare straight across.
if x.exp == y.exp {
if x.isCompact() {
if y.isCompact() {
return arith.Cmp(x.compact, y.compact)
}
return -1 // y.isInflateed
}
if y.isCompact() {
return +1 // !x.isCompact
}
return x.unscaled.CmpAbs(&y.unscaled)
}
// Signs are the same and the scales differ. Compare the
// lengths of their integral parts; if they differ in length
// one number is larger.