|
Do you know any source that will either explain me how to convert a float/double to string or even better provide the complete code for me? |
Answered by
MrSmith33
Dec 4, 2021
Replies: 1 comment 1 reply
|
Conversion of floats to string is pretty complicated topic. I'm searching for compact and easy to port sources myself, but the smaller the method, the more flaws it has. Ryu one is the latest research (see a list of implementations there). Of course it matters only if you want precise conversion between float and string. I've only looked at a couple ryu implementations, but the one written in Go is pretty compact and readable, I think. |
1 reply
Answer selected by
rempas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Conversion of floats to string is pretty complicated topic. I'm searching for compact and easy to port sources myself, but the smaller the method, the more flaws it has. Ryu one is the latest research (see a list of implementations there). Of course it matters only if you want precise conversion between float and string.
I've only looked at a couple ryu implementations, but the one written in Go is pretty compact and readable, I think.