Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8275863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:12:21+00:00 2026-06-08T08:12:21+00:00

In my python code, I regularly verify some calculations using numpy.allclose . On the

  • 0

In my python code, I regularly verify some calculations using numpy.allclose. On the other hand, apart from these checks the implementation is able to deal with multiprecision (mpmath.mpc) numbers. If I want to run my verification code for the mpmath numbers, I get something like

>>> check(H)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
File "module.py", line 19, in check_H
  assert(numpy.allclose(H, I, rtol=rtol, atol=atol))
File "/home/gereon/python/numpy/core/numeric.py", line 2025, in allclose
  xinf = isinf(x)
TypeError: ufunc 'isinf' not supported for the input types, and the inputs could
not be safely coerced to any supported types according to the casting rule ''safe''

What is the best way to check if two multiprecision arrays are sufficiently equal?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:12:22+00:00Added an answer on June 8, 2026 at 8:12 am

    I looked through the code (allclose in numeric.py). It depends on the isinf function, which is apparently not implemented for mpmath.

    The function is simple enough though. It boils down to:

    def allclose(x, y, rtol=1.e-5, atol=1.e-8):
        return all(less_equal(abs(x-y), atol + rtol * abs(y)))
    

    You may have to replace rtol and atol with mpmath equivalents instead of floats.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got Python code with a preamble containing the line: from numpy import array,arccosh,random_integers
I have some python code using shutil.copyfile: import os import shutil src='C:\Documents and Settings\user\Desktop\FilesPy'
I had some code that worked fine removing punctuation/numbers using regular expressions in python,
Here is some sample Python code: import re some_regex = re.compile(r\s+1\s+) result = some_regex.search(
when I write Python code from the interpreter I can type dir() to have
I found some old Python code that was doing something like: if type(var) is
I have some python code that I wrote to convert a python list into
I'm writing some speech recognition code in python and I want it to be
I am trying to parse some C# code to Python. There are several regular
Is there any Python library or some sample code which demonstrates how to convert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.