OXIESEC PANEL
- Current Dir:
/
/
opt
/
golang
/
1.19.4
/
src
/
strconv
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
π
..
-
12/01/2022 06:13:58 PM
rwxr-xr-x
π
atob.go
974 bytes
12/01/2022 06:13:00 PM
rw-r--r--
π
atob_test.go
1.89 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
atoc.go
3.02 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
atoc_test.go
6.83 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
atof.go
15.9 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
atof_test.go
23.6 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
atoi.go
7.68 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
atoi_test.go
17.04 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
bytealg.go
419 bytes
12/01/2022 06:13:00 PM
rw-r--r--
π
bytealg_bootstrap.go
430 bytes
12/01/2022 06:13:00 PM
rw-r--r--
π
ctoa.go
1 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
ctoa_test.go
1.45 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
decimal.go
11.03 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
decimal_test.go
3.01 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
doc.go
1.87 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
eisel_lemire.go
41.39 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
example_test.go
8.18 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
export_test.go
240 bytes
12/01/2022 06:13:00 PM
rw-r--r--
π
fp_test.go
2.9 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
ftoa.go
14.02 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
ftoa_test.go
9.33 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
ftoaryu.go
15.67 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
ftoaryu_test.go
759 bytes
12/01/2022 06:13:00 PM
rw-r--r--
π
internal_test.go
618 bytes
12/01/2022 06:13:00 PM
rw-r--r--
π
isprint.go
11.06 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
itoa.go
5.3 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
itoa_test.go
5.67 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
makeisprint.go
4.83 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
quote.go
16.93 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
quote_test.go
9.57 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
strconv_test.go
2.86 KB
12/01/2022 06:13:00 PM
rw-r--r--
π
testdata
-
12/01/2022 06:13:56 PM
rwxr-xr-x
Editing: atoc.go
Close
// 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 const fnParseComplex = "ParseComplex" // convErr splits an error returned by parseFloatPrefix // into a syntax or range error for ParseComplex. func convErr(err error, s string) (syntax, range_ error) { if x, ok := err.(*NumError); ok { x.Func = fnParseComplex x.Num = s if x.Err == ErrRange { return nil, x } } return err, nil } // ParseComplex converts the string s to a complex number // with the precision specified by bitSize: 64 for complex64, or 128 for complex128. // When bitSize=64, the result still has type complex128, but it will be // convertible to complex64 without changing its value. // // The number represented by s must be of the form N, Ni, or NΒ±Ni, where N stands // for a floating-point number as recognized by ParseFloat, and i is the imaginary // component. If the second N is unsigned, a + sign is required between the two components // as indicated by the Β±. If the second N is NaN, only a + sign is accepted. // The form may be parenthesized and cannot contain any spaces. // The resulting complex number consists of the two components converted by ParseFloat. // // The errors that ParseComplex returns have concrete type *NumError // and include err.Num = s. // // If s is not syntactically well-formed, ParseComplex returns err.Err = ErrSyntax. // // If s is syntactically well-formed but either component is more than 1/2 ULP // away from the largest floating point number of the given component's size, // ParseComplex returns err.Err = ErrRange and c = Β±Inf for the respective component. func ParseComplex(s string, bitSize int) (complex128, error) { size := 64 if bitSize == 64 { size = 32 // complex64 uses float32 parts } orig := s // Remove parentheses, if any. if len(s) >= 2 && s[0] == '(' && s[len(s)-1] == ')' { s = s[1 : len(s)-1] } var pending error // pending range error, or nil // Read real part (possibly imaginary part if followed by 'i'). re, n, err := parseFloatPrefix(s, size) if err != nil { err, pending = convErr(err, orig) if err != nil { return 0, err } } s = s[n:] // If we have nothing left, we're done. if len(s) == 0 { return complex(re, 0), pending } // Otherwise, look at the next character. switch s[0] { case '+': // Consume the '+' to avoid an error if we have "+NaNi", but // do this only if we don't have a "++" (don't hide that error). if len(s) > 1 && s[1] != '+' { s = s[1:] } case '-': // ok case 'i': // If 'i' is the last character, we only have an imaginary part. if len(s) == 1 { return complex(0, re), pending } fallthrough default: return 0, syntaxError(fnParseComplex, orig) } // Read imaginary part. im, n, err := parseFloatPrefix(s, size) if err != nil { err, pending = convErr(err, orig) if err != nil { return 0, err } } s = s[n:] if s != "i" { return 0, syntaxError(fnParseComplex, orig) } return complex(re, im), pending }