New python module to simulate arbitrary fixed and infinite precision binary floating point

Steven D'Aprano steve at
Mon Aug 11 18:39:41 CEST 2008

On Sun, 10 Aug 2008 16:34:34 -0400, Rob Clewley wrote:

> Dear Pythonistas,
> How many times have we seen posts recently along the lines of "why is it
> that 0.1 appears as 0.10000000000000001 in python?" that lead to posters
> being sent to the definition of the IEEE 754 standard and the
> module? I am teaching an introductory numerical analysis class this
> fall, and I realized that the best way to teach this stuff is to be able
> to play with the representations directly
> Consequently, I have written a module to simulate the machine
> representation of binary floating point numbers and their arithmetic.
> Values can be of arbitrary fixed precision or infinite precision, along
> the same lines as python's in-built decimal class. The code is here: 

I would be interested to look at that, if I can find the time.

Is this related to minifloats?


More information about the Python-list mailing list