diff options
| author | YDBot <[email protected]> | 2026-06-10 06:27:27 +0000 |
|---|---|---|
| committer | YDBot <[email protected]> | 2026-06-10 06:27:27 +0000 |
| commit | eb8c7d3ee0c13034ecf5d8d35c24cefc40f0bb3f (patch) | |
| tree | a1eba7fec49a258bb24bfa77808233496ac0047f /contrib/go/_std_1.25/src/strconv/ctoa.go | |
| parent | c4011885693f041c96b035f368aae8a1baac8885 (diff) | |
| parent | 72cfbf8958fa6fa5227e9ad6466abfc635fdeb15 (diff) | |
Diffstat (limited to 'contrib/go/_std_1.25/src/strconv/ctoa.go')
| -rw-r--r-- | contrib/go/_std_1.25/src/strconv/ctoa.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/contrib/go/_std_1.25/src/strconv/ctoa.go b/contrib/go/_std_1.25/src/strconv/ctoa.go deleted file mode 100644 index fd7f941d703..00000000000 --- a/contrib/go/_std_1.25/src/strconv/ctoa.go +++ /dev/null @@ -1,27 +0,0 @@ -// 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. - -package strconv - -// FormatComplex converts the complex number c to a string of the -// form (a+bi) where a and b are the real and imaginary parts, -// formatted according to the format fmt and precision prec. -// -// The format fmt and precision prec have the same meaning as in [FormatFloat]. -// It rounds the result assuming that the original was obtained from a complex -// value of bitSize bits, which must be 64 for complex64 and 128 for complex128. -func FormatComplex(c complex128, fmt byte, prec, bitSize int) string { - if bitSize != 64 && bitSize != 128 { - panic("invalid bitSize") - } - bitSize >>= 1 // complex64 uses float32 internally - - // Check if imaginary part has a sign. If not, add one. - im := FormatFloat(imag(c), fmt, prec, bitSize) - if im[0] != '+' && im[0] != '-' { - im = "+" + im - } - - return "(" + FormatFloat(real(c), fmt, prec, bitSize) + im + "i)" -} |
