[Python-ideas] Way to check for floating point "closeness"?

Ethan Furman ethan at stoneleaf.us
Thu Jan 15 01:38:04 CET 2015


On 01/14/2015 04:18 PM, Steven D'Aprano wrote:
> On Wed, Jan 14, 2015 at 02:44:27AM -0800, Andrew Barnert wrote:
> 
>> I think your confusion here is entirely my fault. For simplicity, it's 
>> often helpful to look at tiny float representations--e.g., a 4-bit 
>> float with 1 sign bit, 1 mantissa bit, and 2 exponent bits (that, if 
>> both 1, mean inf/nan), 
> 
> Since this is python-ideas, how about a minifloat type?
> 
> I think a 4-bit float is a bit *too* mini, 8-bit sounds about right.
> 
> 
> (I know, I know, it should be a third-party library, not a built-in :-)

Speaking of which:

  https://pypi.python.org/pypi/bigfloat/0.3.0

I know it's /called/ bigfloat, but it /looks/ like you can specify however many/few bits you want.  ;)

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150114/248b28cb/attachment.sig>


More information about the Python-ideas mailing list