[Numpy-discussion] Decimal arrays?

Charles R Harris charlesr.harris@gmail....
Sat Aug 20 18:41:49 CDT 2011


On Sat, Aug 20, 2011 at 4:49 PM, Chris Withers <chris@simplistix.co.uk>wrote:

> On 20/08/2011 15:38, Robert Kern wrote:
> > On Sat, Aug 20, 2011 at 17:37, Chris Withers<chris@simplistix.co.uk>
>  wrote:
> >> Hi All,
> >>
> >> What's the best type of array to use for decimal values?
> >> (ie: where I care about precision and want to avoid any possible
> >> rounding errors)
> >
> > dtype=object
>
> Thanks!
>
> What are the performance implications, if any, of this array type?
>
>
It will be slower, the effect depends on how much data/computation you have.
You need to look into using the decimal objects in  decimal
module<http://docs.python.org/library/decimal.html>,
i.e., import decimal. Note that 1/7 still isn't going to be exact in
decimals.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110820/a186df94/attachment.html 


More information about the NumPy-Discussion mailing list