Skip to content

Invalid promotion of numpy scalar to float64 (Trac #346) #944

Closed

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/346 on 2006-10-14 by @charris, assigned to unknown.

In [95]: a = np.float32(1)

In [96]: a.dtype
Out[96]: dtype('float32')

In [97]: a /= 2

In [98]: a.dtype
Out[98]: dtype('float64')

Result type of a should still be float32. This also holds for +=, -=, and *=.

Activity

  1. numpy-gitbot commented on Oct 19, 2012

    @numpy-gitbot
    Author

    @teoliphant wrote on 2006-10-16

    This is not necessarily true. Array scalars are not considered special. They are just scalars. When two scalars are involved in an operation, the normal rules of coercion apply. Different rules would require a change to NumPy that needs to wait until 1.1

    This is intended behavior.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions