Skip to content

test_Normalize fails on aarch64/ppc64le/s390x #23707

Closed

Description

@QuLogic

# This returns exactly 0.5 when longdouble is extended precision (80-bit),
# but only a value close to it when it is quadruple precision (128-bit).
np.testing.assert_array_almost_equal_nulp(norm(1 + 50 * eps), 0.5)

This seems to be a bit too strict now, as it is failing on aarch64, ppc64le, and s390x, where the result is 0.50096339.

Also, on my 64-bit AMD system, which is apparently using np.float128 for np.longdouble (though I don't know if that means 80-bit internally), it seems to return 0.5 exactly, which seems the opposite of the comment.

Originally posted by @QuLogic in #21634 (comment)

Activity

  1. added this to the v3.6.0 milestone on Aug 22, 2022
  2. QuLogic commented on Aug 22, 2022

    @QuLogic
    MemberAuthor

    On my (64-bit AMD) system, we have this precision info:

    >>> np.finfo(np.longdouble)
    finfo(resolution=1e-18, min=-1.189731495357231765e+4932, max=1.189731495357231765e+4932, dtype=float128)
    

    On aarch64, ppc64le, and s390x, it is:

    >>> np.finfo(np.longdouble)
    finfo(resolution=1e-33, min=-1.189731495357231765085759326628007e+4932, max=1.189731495357231765085759326628007e+4932, dtype=float128)
    

    So I guess that resolution difference explains the comment at least.

    But that means the test needs some loosening. However, I'm not sure why the nightly tests precipitated this change, @greglucas.

  3. changed the title [-]test_Normalize fails on ppc64le/s390x[/-] [+]test_Normalize fails on arch64/ppc64le/s390x[/+] on Aug 22, 2022
  4. changed the title [-]test_Normalize fails on arch64/ppc64le/s390x[/-] [+]test_Normalize fails on aarch64/ppc64le/s390x[/+] on Aug 22, 2022
  5. greglucas commented on Aug 22, 2022

    @greglucas
    Contributor

    I think that the necessary change was above that update and I was updating the area and saw that we were only testing that was between 0 < x < 1 which seemed way too loose to me. So, it seems fine to loosen this back up again if it is causing issues on other platforms.

  6. added a commit that references this issue on Aug 22, 2022
    e3424d0
  7. added a commit that references this issue on Apr 19, 2026
    cdd53d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions