Skip to content

strconv: ParseComplex fails to accept "0_0+0x_0p0i" #38962

@griesemer

Description

@griesemer

Reproducer:

package main

import "fmt"
import "strconv"

func main() {
	x, err := strconv.ParseComplex("0_0+0x_0p0i", 128)
	if err != nil {
		panic(err)
	}
	fmt.Println(x)
}

We just added function ParseComplex to strconv so this is a release blocker.

The problem is in readFloat where we check for underscoreOk for the whole string rather than only the string read so far (atof.go:303).

Fix is trivial, need more tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions