MCPcopy Create free account
hub / github.com/cockroachdb/apd / fmtE

Function fmtE

format.go:105–122  ·  view source on GitHub ↗

%e: d.ddddde±d

(buf []byte, fmt byte, d *Decimal, digits []byte)

Source from the content-addressed store, hash-verified

103
104// %e: d.ddddde±d
105func fmtE(buf []byte, fmt byte, d *Decimal, digits []byte) []byte {
106 adj := int64(d.Exponent) + int64(len(digits)) - 1
107 buf = append(buf, digits[0])
108 if len(digits) > 1 {
109 buf = append(buf, '.')
110 buf = append(buf, digits[1:]...)
111 }
112 buf = append(buf, fmt)
113 var ch byte
114 if adj < 0 {
115 ch = '-'
116 adj = -adj
117 } else {
118 ch = '+'
119 }
120 buf = append(buf, ch)
121 return strconv.AppendInt(buf, adj, 10)
122}
123
124// %f: ddddddd.ddddd
125func fmtF(buf []byte, d *Decimal, digits []byte) []byte {

Callers 1

AppendMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…