Skip to content

Floating-point pow gives different results on different platforms #10010

Open
@ahaldane

Description

@ahaldane

This is a reminder that we have seen a few inconsistencies in the floating-point pow function on linux vs windows vs darwin.

The problems:

  1. The operation 10.**arange(308) on linux correctly gives the nearest IEEE float64 to all possible powers of 10, with unbiased rounding. In other words we have 10.**np.float64(i) == np.float64('1e%d' %i) for all i. On some windows systems this is often not the case for i >= 23 (where float64 values are no longer integers), where it gives a slightly different value. I put a list of appveyor envs where this fails below marked with X. See ENH: Use Dragon4 algorithm to print floating values #9941 (comment)
  2. The mac pow function fails for 2.**exp with exp >= 1024. See BUG: Fix casting from longdouble to long #9971 (comment) MAINT: Fix test_int_from_huge_longdouble on Darwin. #10000
   PYTHON=C:\Python27, PYTHON_VERSION=2.7, PYTHON_ARCH=32, SKIP_NOTAG=true, TEST_MODE=full
   PYTHON=C:\Python36, PYTHON_VERSION=3.6, PYTHON_ARCH=32, TEST_MODE=fast
 X PYTHON=C:\Python27-x64, PYTHON_VERSION=2.7, PYTHON_ARCH=64, TEST_MODE=fast
 X PYTHON=C:\Python34-x64, PYTHON_VERSION=3.4, PYTHON_ARCH=64, TEST_MODE=fast
 X PYTHON=C:\Python36-x64, PYTHON_VERSION=3.6, PYTHON_ARCH=64, TEST_MODE=full
   PYTHON=C:\Python27, PYTHON_VERSION=2.7, PYTHON_ARCH=32, SKIP_NOTAG=true, TEST_MODE=full
   PYTHON=C:\Python34, PYTHON_VERSION=3.4, PYTHON_ARCH=32, SKIP_NOTAG=true, TEST_MODE=full
   PYTHON=C:\Python35-x64, PYTHON_VERSION=3.5, PYTHON_ARCH=64, SKIP_NOTAG=true, TEST_MODE=full
   PYTHON=C:\Python35, PYTHON_VERSION=3.5, PYTHON_ARCH=32, SKIP_NOTAG=true, TEST_MODE=full

from this test

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