MCPcopy Create free account
hub / github.com/pquerna/ffjson / ParseFloat

Function ParseFloat

fflib/v1/internal/atof.go:550–557  ·  view source on GitHub ↗

ParseFloat converts the string s to a floating-point number with the precision specified by bitSize: 32 for float32, or 64 for float64. When bitSize=32, the result still has type float64, but it will be convertible to float32 without changing its value. If s is well-formed and near a valid floating

(s []byte, bitSize int)

Source from the content-addressed store, hash-verified

548// away from the largest floating point number of the given size,
549// ParseFloat returns f = ±Inf, err.Err = ErrRange.
550func ParseFloat(s []byte, bitSize int) (f float64, err error) {
551 if bitSize == 32 {
552 f1, err1 := atof32(s)
553 return float64(f1), err1
554 }
555 f1, err1 := atof64(s)
556 return f1, err1
557}
558
559// oroginal: strconv/decimal.go, but not exported, and needed for PareFloat.
560

Callers

nothing calls this directly

Calls 2

atof32Function · 0.85
atof64Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…