469,625 Members | 1,086 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

decimal numarray

km
Hi all,
is there any support for decimal type in numarray module ?
regards,
KM
Jul 19 '05 #1
1 1414

"km" <km@mrna.tn.nic.in> wrote in message
news:ma**************************************@pyth on.org...
Hi all,
is there any support for decimal type in numarray module ?
regards,
KM


Still a noob but perhaps you can use gmpy, a wrapper for GMP arbitrary
precision library. I found it here http://gmpy.sourceforge.net/

I just tried this and seemed to produce an array of gmpy.mpf types. Gmpy
also has support for arbirtrary length integers (mpz) and rationals (mpq).
Works for me. Hope this helps.

In [14]: sl=[gmpy.mpf(2)]*10

In [15]: sl
Out[15]:
[mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0'),
mpf('2.e0')]

In [16]: x=array(sl)

In [17]: x
Out[17]: NumPy array, format: long
[2.0 ,2.0 ,2.0 ,2.0 ,2.0 ,2.0 ,2.0 ,2.0 ,2.0 ,2.0 ,]

In [18]: x[0]
Out[18]: mpf('2.e0')


Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by RJS | last post: by
3 posts views Thread by Alexander Schwaigkofler | last post: by
4 posts views Thread by Marco Bubke | last post: by
4 posts views Thread by Marco Bubke | last post: by
2 posts views Thread by Marc Schellens | last post: by
3 posts views Thread by SunX | last post: by
3 posts views Thread by Mizrandir | last post: by
reply views Thread by andrewfelch | last post: by
reply views Thread by robert | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.