INNER CODE UNIT · Go

cmpAbsInt

ericlagergren/decimal · big.go:408

func cmpAbsInt(x *Big, y int64) int {
	u := uint64(y)

	// Same scales, so compare straight across.
	if x.exp == 0 {
		// If the scales are the same and x x is not compact,
		// then by definition it's larger than y.
		if !x.isCompact() {
			return +1
		}
		return arith.Cmp(x.compact, u)
	}

	// Signs are the same and the scales differ. Compare the
	// lengths of their integral parts; if they differ in length
	// one number is larger.
	// E.g.: 1234.01
	//       1230011

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…