MCPcopy
hub / github.com/tinylib/msgp / String

Method String

msgp/number.go:374–390  ·  view source on GitHub ↗

String implements fmt.Stringer

()

Source from the content-addressed store, hash-verified

372
373// String implements fmt.Stringer
374func (n *Number) String() string {
375 switch n.typ {
376 case InvalidType:
377 return "0"
378 case Float32Type, Float64Type:
379 f, _ := n.Float()
380 return strconv.FormatFloat(f, 'f', -1, 64)
381 case IntType:
382 i, _ := n.Int()
383 return strconv.FormatInt(i, 10)
384 case UintType:
385 u, _ := n.Uint()
386 return strconv.FormatUint(u, 10)
387 default:
388 panic("(*Number).typ is invalid")
389 }
390}

Callers 1

TestNumberFunction · 0.95

Calls 3

FloatMethod · 0.95
IntMethod · 0.95
UintMethod · 0.95

Tested by 1

TestNumberFunction · 0.76