Take heed! This is Python 3.0 *only*. It will not work with Python 2.5. If you don&#39;t like code with sharp edges and scary corners, don&#39;t bother.<br><br>Okay, here&#39;s the barebones, scrapped together version. It&#39;s ugly. It&#39;s messy. It might eat your kids. On the other hand, it seems to work.
<br><br><a href="http://umass.glexia.net/mpf.tar.bz2" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://umass.glexia.net/mpf.tar.bz2 </a><br><br>It provides a module, mpf, with an MPF type and a bunch of methods.
<br>You can directly set the value of an MPF type by setting the value attribute to a string containing a number.<br>You can read the value of an MPF type by getting value. Note that it will come back as a tuple in the form 
<br>(base, sign, whole, decimal)<br><br>whole and decimal will be strings. This is to avoid losing precision. I couldn&#39;t think of another way to easily work with values that can be<br>(theoretically) infinite.<br><br>
 If the number is 0, value will be None. If there isn&#39;t a whole part (or a decimal part), its place in the tuple will be set to None.<br>If you want to change the default precision (128 bits), use the keyword prec in the costructor. It takes a Long. 
<br><br>The MPF type implements rich comparisons. The MPF type does not (yet) implement&nbsp;the&nbsp;Number&nbsp;methods.&nbsp;It&nbsp;will.<br> The methods provided by mpf are...<br><br>(these methods take two MPF values and return an MPF value): 
<br><br>mpf_add<br> mpf_sub<br>mpf_div<br>mpf_mul<br><br>(these methods take one MPF value and return... gasp.. one MPF value):<br><br>mpf_sqrt<br>mpf_abs<br>mpf_neg<br><br>(this method has a stub and does not exist yet): 
<br><br>mpf_pow<br><br>Sharp Edges:<br><br>If you try to set value to something weird, like a dictionary, it will segfault. PyString_Check wasn&#39;t working for me. It&#39;s in there, but defined out.<br>If you divide by zero, GNU MP will crash it saying &quot;Floating point exception.&quot; Same goes for... well, I forgot already. I&#39;ve been hacking on this nearly 
<br>24 hours straight and I&#39;m new to both the Python API and GNU MP.<br><br>Anything else? Good luck, hope someone likes it. I&#39;ll be continuing to work on it, hopefully eliminate some redundancy in the code,<br>clean it up, flesh out the floating point support. After that, it&#39;s on to integers. 
<br><span class="sg"><br>Rob<br></span>