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)
| 548 | // away from the largest floating point number of the given size, |
| 549 | // ParseFloat returns f = ±Inf, err.Err = ErrRange. |
| 550 | func 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 |