Skip to content

BUG: nansum platform overflow #83

@jreback

Description

@jreback

this is on 32-bit linux
on 64-bit the the int dtypes work correctly
stems from here

numpy/numpy#4638
pandas-dev/pandas#6915

workaround with numpy is to do arithmetic in highest dtype, e.g. values.sum(dtype='float64') then cast back

>>> import numpy as np
>>> import bottleneck as bn
>>> bn.__version__
'0.8.0'
>>> np.__version__
'1.8.1'

>>> float(bn.nansum(np.arange(5000000,dtype='float32')))
12499997949952.0
>>> float(bn.nansum(np.arange(5000000,dtype='float64')))
12499997500000.0
>>> int(bn.nansum(np.arange(5000000,dtype='int32')))
1642668640
>>> int(bn.nansum(np.arange(5000000,dtype='int64')))
12499997500000L

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions