float limits

Skip Montanaro skip at pobox.com
Wed Jan 30 09:21:31 EST 2002


    Alexandre> Is there a way of knowing what the value of the smallest
    Alexandre> positive float available on a given machine from within
    Alexandre> python? A bit like sys.maxint, but for mindouble. Similarly,
    Alexandre> I'd like to know the value of the biggest positive float,
    Alexandre> maxfloat. If the solution is portable, that's all the better.

I searched around but didn't see anything already in the code.  I picked up
a program by Steven Pemberton called enquire several years ago.  You can get
the latest version here:

    http://www.cwi.nl/~steven/enquire.html

It's kind of cool because it's both a C program and a shell script.  You
execute it with sh to compile it and run some tests.

(I wonder if using it to generate values for use in Python - perhaps an
adjunct to mathmodule.c for the floating point stuff - would be worthwhile?)

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list