8000 Wrong output while using geomspace with dtype=int keyword argument · Issue #9987 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
Wrong output while using geomspace with dtype=int keyword argument #9987
Open
@ashwinvis

Description

@ashwinvis

System details

  • system : Linux
  • kernel : 4.9.0-4-amd64
  • distro : debian 9.2
  • CC : gcc (Debian 6.3.0-18) 6.3.0 20170516
  • BLAS/LAPACK : atlas
  • python : 3.5.3 and 2.7.13
  • numpy : 1.13.3

Test case

Code

import numpy as np
gp1 = np.geomspace(2, 8, 3, dtype=int)
gp2 = np.geomspace(2, 8, 3)
np.testing.assert_equal(gp1, gp2)

Traceback

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/scratch/avmo/opt/fluidmeta3/lib/python3.5/site-packages/numpy/testing/utils.py", line 343, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/scratch/avmo/opt/fluidmeta3/lib/python3.5/site-packages/numpy/testing/utils.py", line 854, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/scratch/avmo/opt/fluidmeta3/lib/python3.5/site-packages/numpy/testing/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

(mismatch 66.66666666666666%)
 x: array([2, 3, 7])
 y: array([ 2.,  4.,  8.])

I would have expected an output like [2, 4 ,8] and not [2, 3, 7]. This occurs with both python 2.7 and 3.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0