You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both MultiwordInt and FixedPoint should have methods to convert them to strings, possibly with the usual floating-point modifiers for FixedPoint (i.e. precision and printing as scientific/engineering/...)
The text was updated successfully, but these errors were encountered:
Awesome! I think the best way to do this here would be to have to_string() methods on both classes that each return a std::string - std::to_string doesn't allow you to have options like the precision, and using a std::stringstream feels a bit heavy.
should work fine, possibly with some optional enum parameter for the FixedPoint version that lets you select scientific/engineering/etc notations, like the %e, %f, %g specifiers for printf, if you don't think that it's too much work. Maybe do it in a second pull request :)
I haven't thought about the implementation details too much, but I'd use a (for MultiwordInteger) char[size/3+2] as buffer and create and return an std::string from that.
For FixedPoint numbers, the needed string length should not be larger than integralWidth/3+fractionalWidth+2.
I'd put the code in the *Utility.h files. Don't worry too much about the style, I'm probably inconsistent myself and if I don't like it I'll just change stuff a bit before I merge the PR.
Both MultiwordInt and FixedPoint should have methods to convert them to strings, possibly with the usual floating-point modifiers for FixedPoint (i.e. precision and printing as scientific/engineering/...)
The text was updated successfully, but these errors were encountered: