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
>>> from gmpy2 import digits
>>> help(digits)
Help on built-in function digits in module gmpy2.gmpy2:
digits(...)
digits(x, base=10, prec=0, /) -> str
Return string representing a number x.
In fact, output is different: it's a string for mpz/mpq, but a 3-tuple for mpfr and a 2-tuple for mpc. Signature looks to complex to be described in details, probably -> str | tuple will be enough. Documentation should be adjusted too.
Maybe we should deprecate this function in favor of instance methods (e.g. mpfr.digits())? I think that a generic function, returning a string - is better. Something like to_str(num, base=10, prec=0, /), which will be a wrapper to mpfr_out_str() for the mpfr type.
The text was updated successfully, but these errors were encountered:
E.g.:
In fact, output is different: it's a string for mpz/mpq, but a 3-tuple for mpfr and a 2-tuple for mpc. Signature looks to complex to be described in details, probably
-> str | tuple
will be enough. Documentation should be adjusted too.Maybe we should deprecate this function in favor of instance methods (e.g. mpfr.digits())? I think that a generic function, returning a string - is better. Something like
to_str(num, base=10, prec=0, /)
, which will be a wrapper tompfr_out_str()
for the mpfr type.The text was updated successfully, but these errors were encountered: