<div dir="ltr">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).<div><br></div><div>Best,</div><div><br></div><div>Neil</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 7, 2018 at 5:02 PM Chris Angelico <<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Feb 8, 2018 at 8:49 AM, Neil Girdhar <<a href="mailto:mistersheik@gmail.com" target="_blank">mistersheik@gmail.com</a>> wrote:<br>
> Arbitrary radix comes up every now and then and Decimal already has a<br>
> radix() method. It would be nice when initializing a Decimal object to be<br>
> able to specify an arbitrary radix>=2.<br>
><br>
<br>
The radix method always returns 10, because decimal.Decimal always<br>
operates in base 10. Are you looking for a way to change the way<br>
arithmetic is done, or are you looking for a way to construct a<br>
Decimal from a string of digits and an arbitrary base (the way<br>
int("...", x) does)?<br>
<br>
ChrisA<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
<br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/python-ideas/twWEvFwahaQ/unsubscribe" rel="noreferrer" target="_blank">https://groups.google.com/d/topic/python-ideas/twWEvFwahaQ/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href="mailto:python-ideas%2Bunsubscribe@googlegroups.com" target="_blank">python-ideas+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
</blockquote></div>