Skip to content

Commit

Permalink
- amend based on review comments
Browse files Browse the repository at this point in the history
- User rune instead of string for comparison
  • Loading branch information
pjebs committed Apr 20, 2020
1 parent cefda0c commit 4ec856a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/strconv/ctoa.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -27,15 +27,15 @@ package strconv
// The special precision -1 uses the smallest number of digits
// necessary such that ParseComplex will return c exactly.
func FormatComplex(c complex128, fmt byte, prec, bitSize int) string {

if bitSize == 64 {
bitSize = 32
} else {
bitSize = 64
}

// Check if imaginary part has a sign. If not, add one.
imag := FormatFloat(imag(c), fmt, prec, bitSize)
if imag[0:1] != "+" && imag[0:1] != "-" {
if imag[0] != '+' && imag[0] != '-' {
imag = "+" + imag
}

Expand Down

0 comments on commit 4ec856a

Please # to comment.