INNER CODE UNIT · Go

maxMantissa

ericlagergren/decimal · big.go:724

		maxMantissa = 1<<53 + 1 // largest exact mantissa
	)

	parse := false
	switch xc := x.compact; {
	case !x.isCompact():
		parse = true
	case x.isZero():
		f = 0
		ok = true
	case x.exp == 0:
		f = float64(xc)
		ok = xc < maxMantissa || (xc&(xc-1)) == 0
	case x.exp > 0:
		f = float64(x.compact) * math.Pow10(x.exp)
		ok = x.compact < maxMantissa && !math.IsInf(f, 0) && !math.IsNaN(f)
	case x.exp < 0:
		f = float64(x.compact) / math.Pow10(-x.exp)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…