On Tue, Feb 8, 2022 at 12:19 AM Brett Cannon <br...@python.org> wrote:
> Do we have a buildbot that has a CPU or OS that can't handle IEEE-754? What 
> are the chances we will get one? If the answers are "none" and "slim", then 
> it seems reasonable to require NaN and IEEE-754.

All CPU architectures of current buildbot workers use IEEE 754 (little
or big endian).

I looked at the following CPU architectures:

* x86 (Intel 32-bit)
* x86-64 (Intel 64-bit)
* armv7l (ARM 32-bit)
* aarch64 (ARM 64-bit)
* ppc64, ppc64le (PowerPC 64-bit)
* s390x (IBM)

There is also a "SPARCv9 Oracle Solaris 11.4" worker, but sadly it
seems to be disconnected for 3 months. The SPARCv9 architecture uses
IEEE 754.

On buildbots, I checked float.__getformat__("double"). It is logged as
"builtins.float.double_format" in the "pythoninfo" step of buidbots.

Little-endian examples:

* x86-64 (AMD64 Arch Linux Asan Debug 3.x): IEEE, little-endian
* x86 (Gentoo Non-Debug with X 3.x): IEEE, little-endian
* aarch64 (CentOS9 LTO + PGO 3.10): IEEE, little-endian
* aarch64 (Fedora Rawhide Clang 3.x): IEEE, little-endian
* aarch64: MacOS M1 (ARM64 macOS 3.x): IEEE, little-endian
* aarch64 (ARM64 Windows 3.x): IEEE, little-endian
* PPC64LE (CentOS9 3.10): IEEE, little-endian
* armv7l (ARM Raspbian 3.x): IEEE, little-endian

Big-endian examples:

* PPC64 (AIX 3.x): IEEE, big-endian
* s390x (Debian 3.x): IEEE, big-endian

float.__getformat__("double") is initialized by _PyFloat_InitState()
at Python startup with this code:
---
#if SIZEOF_DOUBLE == 8
    {
        double x = 9006104071832581.0;
        if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
            detected_double_format = ieee_big_endian_format;
        else if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
            detected_double_format = ieee_little_endian_format;
        else
            detected_double_format = unknown_format;
    }
#else
    detected_double_format = unknown_format;
#endif
---

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/4PJP7CB7UXQ6KRRWBBQUIQCLO2LL5JNO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to