I wanted to have something like a binary floating point number like 0.11011. Ideally, it would be as simple as Decimal('0.11011', radix=2). Best, Neil On Wed, Feb 7, 2018 at 5:02 PM Chris Angelico <rosuav@gmail.com> wrote:
On Thu, Feb 8, 2018 at 8:49 AM, Neil Girdhar <mistersheik@gmail.com> wrote:
Arbitrary radix comes up every now and then and Decimal already has a radix() method. It would be nice when initializing a Decimal object to be able to specify an arbitrary radix>=2.
The radix method always returns 10, because decimal.Decimal always operates in base 10. Are you looking for a way to change the way arithmetic is done, or are you looking for a way to construct a Decimal from a string of digits and an arbitrary base (the way int("...", x) does)?
ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
--
--- You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-ideas/twWEvFwahaQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to python-ideas+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.