Skip to content

mpmath.mpf fails converting numpy.int64 #539

Description

@i-am-b-soto

Hi!

I understand there was a very similar issue #382 that is closed, but it appears I'm getting the same issue again.

>>from mpmath import mpf
>>import numpy

>>my_mpf = mpf(numpy.int64(1))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...site-packages/mpmath/ctx_mp_python.py", line 77, in __new__
    v._mpf_ = mpf_pos(cls.mpf_convert_arg(val, prec, rounding), prec, rounding)
  File "...site-packages/mpmath/ctx_mp_python.py", line 96, in mpf_convert_arg
    raise TypeError("cannot create mpf from " + repr(x))
TypeError: cannot create mpf from 1

To my understanding, I'm using the latest version of mpmath

>> import mpmath
>> mpmath.__version__
1.1.0

python --version
3.7.6

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions