Skip to content

uint64 converted to float when dividing by python integer #13057

Closed

Description

@hmaarrfk

I totally get why it is a cause for concern when adding to an int, but I feel like floor division by a positive should be expected to return an integer "safe".

Reproducing code example:

import numpy as np
np.uint64(0) // 4 
Out[2]: -0.0

I guess since I need to divide by 4 I'll just bitshift, but this was kinda unexpected for me.

Numpy/Python version information:

In [3]: import sys, numpy; print(numpy.__version__, sys.version)                                                                                      
1.16.1 3.7.2 (default, Dec 29 2018, 06:19:36) 
[GCC 7.3.0]

installed through conda / conda-forge

xref: #5745

Activity

  1. seberg commented on Nov 19, 2022

    @seberg
    Member

    Closing as duplicate of gh-22624

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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