Skip to content

Commit 04ebaf1

Browse files
committed
- simplify code
1 parent 0f31e5a commit 04ebaf1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/strconv/atoc.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ func convErr(err error, s string) error {
1616

1717
func parseComplexComponent(s, orig string, bitSize int) (float64, error) {
1818
if bitSize == 64 {
19-
f, err := ParseFloat(s, 32)
20-
if err != nil {
21-
return 0, convErr(err, orig)
22-
}
23-
return f, nil
19+
bitSize = 32
20+
} else {
21+
bitSize = 64
2422
}
2523

26-
f, err := ParseFloat(s, 64)
24+
f, err := ParseFloat(s, bitSize)
2725
if err != nil {
2826
return 0, convErr(err, orig)
2927
}

0 commit comments

Comments
 (0)