Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: strconv: make ParseFloat support fraction unicode characters #26159

Closed
pjebs opened this issue Jun 30, 2018 · 6 comments
Closed

proposal: strconv: make ParseFloat support fraction unicode characters #26159

pjebs opened this issue Jun 30, 2018 · 6 comments

Comments

@pjebs
Copy link
Contributor

pjebs commented Jun 30, 2018

It would be nice if ParseFloat would support these characters:

½,, , , ¼, ¾, , , , , , , , , , , , ,

@pjebs
Copy link
Contributor Author

pjebs commented Jun 30, 2018

BTW: I'm only suggesting these be treated as a special case.

@agnivade agnivade changed the title ParseFloat support fraction unicode characters strconv: make ParseFloat support fraction unicode characters Jun 30, 2018
@agnivade agnivade added this to the Unplanned milestone Jun 30, 2018
@ghost
Copy link

ghost commented Jun 30, 2018

Do people need this? Does a library exist that does this? How popular is it?

@pjebs
Copy link
Contributor Author

pjebs commented Jul 1, 2018

I came across a use-case and I assumed the library would convert "9½" to 9.5. I think it's a low-priority "nice-to-have" feature.

@robpike robpike changed the title strconv: make ParseFloat support fraction unicode characters proposal: strconv: make ParseFloat support fraction unicode characters Jul 2, 2018
@ALTree
Copy link
Member

ALTree commented Jul 2, 2018

the library would convert "9½" to 9.5

What is "9⅓" converted to?

@pjebs
Copy link
Contributor Author

pjebs commented Jul 4, 2018

@ALTree It can be documented what a 1/3 will become but it should be the most appropriate representation of 1/3 that a float64 can produce. It can be set by fiat and documented.

@rsc
Copy link
Contributor

rsc commented Jul 9, 2018

Sorry, but no. ParseFloat is for decimals. We're not going to start recognizing circled-1234 etc either.

If you think others would find this useful, it would make sense to publish an external package providing this functionality. It doesn't have to be in the standard library.

@rsc rsc closed this as completed Jul 9, 2018
@golang golang locked and limited conversation to collaborators Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants