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
Feature request.
The math/big types Int and Rat do not provide facilities analogous to strconv that allow
printing and parsing numbers in arbitrary bases. This would be nice to have.
The text was updated successfully, but these errors were encountered:
big.Int certainly permits arbitrary bases:
http://golang.org/pkg/math/big/#Int.SetString : for SetString one can provide a base
http://golang.org/pkg/math/big/#Int.Format : Format permits at least the common bases
(all the code is present internally: if you have a good API suggestion, please let me
know).
For Rat we have SetFrac where one can set each part of the fraction which can be scanned
via SetString. But what's more needed here would be a good API suggestion. What's the
notation for a floating-point number or fraction represented in a different base.
Don't know how I missed the base in SetString. Thanks. It's not in Rat though, so I need
to do a little dance for that, which is doable but clumsy.
Use of Format requires changing the verb for the job and is limited to the standard
bases. It works but not generally and somewhat clumsily in the context I have.
The API I had in mind was suggested by my original report: strconv's Parse and Format,
although obviously the name wouldn't work for Format as it's already taken.
The text was updated successfully, but these errors were encountered: