Skip to content

Testing ExactRep #4

@bkj

Description

@bkj

Hi All --

I'm playing with implementing some of the ideas here in PyTorch. I was looking at the ExactRep code and (maybe?) found an issue:

>>> np.__version__
'1.13.1'
>>> x = ExactRep(np.array([2.0]))
>>> a = np.array([0.5])
>>> i = 11
>>> 
>>> for _ in range(i):
...     _ = x.div(a)
... 
>>> for _ in range(i):
...     _ = x.mul(a)
... 
>>> x.val
array([-0.00067149])

Presumably, ExactRep should be able to handle this situation, and correctly return 2.0. Any ideas what might be going on? (If i <= 10, the code works as expected.)

Note that to get ExactRep to run I had to change

class BitStore(object):
    def __init__(self, length):
        ...
        self.store = np.array([0L] * length, dtype=object)

to

class BitStore(object):
    def __init__(self, length):
        ...
        self.store = np.array([0L] * length, dtype=long)

otherwise I get the error

TypeError: ufunc 'add' output (typecode 'O') could not be coerced to provided output parameter (typecode 'l') according to the casting rule ''same_kind''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions