Skip to content

Commit

Permalink
- rename parseFloat to parseComplexComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
pjebs committed Mar 27, 2020
1 parent 8df2934 commit bdf80fd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/strconv/atoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func convErr(err error, s string) error {
return err
}

func parseFloat(s, orig string, bitSize int) (float64, error) {
func parseComplexComponent(s, orig string, bitSize int) (float64, error) {
if bitSize == 64 {
f, err := ParseFloat(s, 32)
if err != nil {
Expand Down Expand Up @@ -76,7 +76,7 @@ func ParseComplex(s string, bitSize int) (complex128, error) {
// Is last character an i?
if lastChar != "i" {
// The last character is not an i so there is only a real component.
real, err := parseFloat(s, orig, bitSize)
real, err := parseComplexComponent(s, orig, bitSize)
if err != nil {
return 0, err
}
Expand All @@ -102,7 +102,7 @@ func ParseComplex(s string, bitSize int) (complex128, error) {
s = s + "1"
}

imag, err := parseFloat(s, orig, bitSize)
imag, err := parseComplexComponent(s, orig, bitSize)
if err != nil {
return 0, err
}
Expand Down Expand Up @@ -133,7 +133,7 @@ func ParseComplex(s string, bitSize int) (complex128, error) {
}

// Check if left and right are valid float64
real, err := parseFloat(left, orig, bitSize)
real, err := parseComplexComponent(left, orig, bitSize)
if err != nil {
continue
}
Expand All @@ -142,7 +142,7 @@ func ParseComplex(s string, bitSize int) (complex128, error) {
right = right + "1"
}

imag, err := parseFloat(right, orig, bitSize)
imag, err := parseComplexComponent(right, orig, bitSize)
if err != nil {
continue
}
Expand All @@ -151,7 +151,7 @@ func ParseComplex(s string, bitSize int) (complex128, error) {
}

// Pure imaginary number in exponential form
imag, err := parseFloat(s, orig, bitSize)
imag, err := parseComplexComponent(s, orig, bitSize)
if err != nil {
return 0, err
}
Expand Down

0 comments on commit bdf80fd

Please # to comment.