Skip to content

numpy.arange stop precision issue #5808

@mjasher

Description

@mjasher

All elements of the array generated by numpy.arange(start, stop, step) should be strictly smaller than stop.

On my Ubuntu 14.04 installation this happened:

In [117]: np.arange(0.5, 0.8, 0.1)
Out[117]: array([ 0.5,  0.6,  0.7,  0.8])

In [118]: np.arange(0.5, 0.9, 0.1)
Out[118]: array([ 0.5,  0.6,  0.7,  0.8])

In [123]: np.arange(0.5, 0.8, 0.1)[-1]
Out[123]: 0.79999999999999993

In [124]: np.arange(0.5, 0.9, 0.1)[-1]
Out[124]: 0.79999999999999993

Is this an issue on other installations?

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