Skip to content

Division of integers returns floor in python 2.x #16

@tompollard

Description

@tompollard

The default behaviour for division has changed between Python 2 and Python 3. In Python 3, dividing an integer by an integer returns a float. e.g.

In  [1]: 3/2
Out [1]: 1.5

In Python 2, the default behaviour is to return an integer (the floor of the division). e.g.

In  [1]: 3/2
Out [1]: 1

The current code does not account for this difference, so incorrect results are returned in Python 2. For example, https://github.com/MIT-LCP/wfdb-python/blob/master/wfdb/_rdann.py includes the line:

testbytes=filebytes[:(12+math.ceil(auxlen/2)),:].flatten()

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