<div dir="ltr">That's really cool! I never knew about gmpy.<br><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 7, 2018 at 7:10 PM Case Van Horsen <<a href="mailto:casevh@gmail.com">casevh@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 Wed, Feb 7, 2018 at 3:49 PM, Neil Girdhar <<a href="mailto:mistersheik@gmail.com" target="_blank">mistersheik@gmail.com</a>> wrote:<br>
> On Wed, Feb 7, 2018 at 6:36 PM Chris Angelico <<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>> wrote:<br>
>> You should be able to use the native float type for binary<br>
>> floating-point. But the whole point of that challenge is that you<br>
>> shouldn't need a computer.<br>
><br>
><br>
> Yeah, I know, but I wanted to play with it. Anyway, native floats don't<br>
> help.<br>
>><br>
>><br>
>> ChrisA<br>
<br>
I maintain gmpy2 and it might do what you want (arbitrary precision<br>
radix-2 arithmetic and easy access to the bits).<br>
<br>
>>> gmpy2.get_context().precision=70<br>
>>> gmpy2.mpfr(1)/7<br>
mpfr('0.14285714285714285714283',70)<br>
>>> (gmpy2.mpfr(1)/7).digits(2)<br>
('1001001001001001001001001001001001001001001001001001001001001001001001',<br>
-2, 70)<br>
<br>
Historical memory - I once wrote a radix-6 fixed point library to<br>
explore an extension of the 3n+1 problem to rational numbers. It was<br>
written in Turbo Pascal and ran for days on a 286/287 PC.<br>
<br>
casevh<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></div>