-
Notifications
You must be signed in to change notification settings - Fork 288
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
Add generic (template) methods for to_string
(float or double).
#160
Comments
I don't see the The It's not completely clear that That said, I can see the use-case where a program just wants to guarantee round-tripping. Since that shouldn't be too common I would template the function that calls into the double-conversion library (as you probably already did). As a consequence I'm currently leaning towards not adding these methods. |
@floitsch Thank you for opening this issue, Florian. I just tried the existing
Obviously, in this case, Given the existing member functions, it seems quite likely to me that users will write code like (in pseudo code):
And I found such user code in a couple of places: And ITK (as I mentioned before at #159 (comment)): https://github.com/InsightSoftwareConsortium/ITK/blob/v5.2.0/Modules/Core/Common/src/itkNumberToString.cxx#L26-L41 As well as duplicate code for float and double, with the So I hope you can consider my pull request #159 "Add |
Simplified ITK's `FloatingPointNumberToString` implementation by using `DoubleToStringConverter::ToShortestString` overload set, proposed by pull request google/double-conversion#159 Related to issue google/double-conversion#160 "Add generic (template) methods for to_string (float or double)", opened by Florian Loitsch (floitsch).
In #158 (comment) @N-Dekker suggests that we should add a templated
ToShortest
method that works differently depending on the template argument.The text was updated successfully, but these errors were encountered: