LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Package strconv implements conversions to and from string representations | 5 // Package strconv implements conversions to and from string representations |
6 // of basic data types. | 6 // of basic data types. |
7 package strconv | 7 package strconv |
8 | 8 |
9 // decimal to binary floating point conversion. | 9 // decimal to binary floating point conversion. |
10 // Algorithm: | 10 // Algorithm: |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // If s is not syntactically well-formed, ParseFloat returns err.Error = ErrSynt
ax. | 397 // If s is not syntactically well-formed, ParseFloat returns err.Error = ErrSynt
ax. |
398 // | 398 // |
399 // If s is syntactically well-formed but is more than 1/2 ULP | 399 // If s is syntactically well-formed but is more than 1/2 ULP |
400 // away from the largest floating point number of the given size, | 400 // away from the largest floating point number of the given size, |
401 // ParseFloat returns f = ±Inf, err.Error = ErrRange. | 401 // ParseFloat returns f = ±Inf, err.Error = ErrRange. |
402 func ParseFloat(s string, bitSize int) (f float64, err error) { | 402 func ParseFloat(s string, bitSize int) (f float64, err error) { |
403 if bitSize == 32 { | 403 if bitSize == 32 { |
404 f1, err1 := atof32(s) | 404 f1, err1 := atof32(s) |
405 return float64(f1), err1 | 405 return float64(f1), err1 |
406 } | 406 } |
407 » f1, err1 := atof64(s) | 407 » return atof64(s) |
408 » return f1, err1 | 408 } |
409 } | |
LEFT | RIGHT |