Skip to content

fmt.Scanf does not parse NaN, +Inf and -Inf correctly #1308

@gopherbot

Description

@gopherbot

by remigillig:

What steps will reproduce the problem?
1. fmt.Printf a value of NaN or +Inf or -Inf into a string
2. fmt.Scanf this string with the same flag (usually %f)
3. An error occurs while trying to parse the string

What is the expected output?
No error reported and "NaN", "+Inf", "-Inf" correctly
returned by fmt.Scanf

What do you see instead?
strconv.NumError is returned by fmt.Scanf

Which compiler are you using (5g, 6g, 8g, gccgo)?
I used 8g from gowin32_2010-11-23

Which operating system are you using?
Windows 7 64 bits

Which revision are you using?  (hg identify)
(Can't do it directly with Windows version)

Please provide any additional information below.
The provided source file exhibits the issue.

Attachments:

  1. scan.go (861 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions