real-accurate, numpy...increased precision help

Chris Barker chrishbarker at home.net
Tue Jul 24 14:35:46 EDT 2001


Bryan Webb wrote:
> I need to be able to work with numbers up to 2^800 in a floating point
> envirnoment.

Python FLoats are C doubles. Numpy supports C dooubles as well, on a
most 32 bit machines, you can get numbers up to 1.8X10^308, which is
greater than 2**800. If you mean 2X10**800,you are out of luck with
NumPy or native Python Floats. Do you really need more precision that 

> I would like an increase of precision over std floats.

Do you really need more precision that doubles? (I think it's 53 bits,
about 16 decimal digits)

>I also
> would like to know the internal representation of the numbers, so that I can
> read and write them to disk in their internal representations..

You can do this withe the struct or array modules, or with numpy's
tostring() and fromstring() methods, without knowing the internal
representation. If you really want to write it bit by bit, find a good
reference for IEEE 754 (it may be in a C book,and any number of other
places as well)

> Should I use real-accurate, or numpy

NumPy gives you a nice notation, and much better performance for working
with arrays of numberes, it willnot give you any added range or
precision.

I only just heard of real-accurate, but if you really need the extra
range and/or precision, it looks pretty nice. It won't be fast, however!

-Chris



-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list