Skip to content
Merged
8 changes: 0 additions & 8 deletions Doc/c-api/float.rst
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,6 @@ endian processor, or ``0`` on little endian processor.
Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set,
most likely :exc:`OverflowError`).

There are two problems on non-IEEE platforms:

* What this does is undefined if *x* is a NaN or infinity.
* ``-0.0`` and ``+0.0`` produce the same bytes string.

.. c:function:: int PyFloat_Pack2(double x, char *p, int le)

Pack a C double as the IEEE 754 binary16 half-precision format.
Expand Down Expand Up @@ -256,9 +251,6 @@ Return value: The unpacked double. On error, this is ``-1.0`` and
:c:func:`PyErr_Occurred` is true (and an exception is set, most likely
:exc:`OverflowError`).

Note that on a non-IEEE platform this will refuse to unpack a bytes string that
represents a NaN or infinity.

.. c:function:: double PyFloat_Unpack2(const char *p, int le)

Unpack the IEEE 754 binary16 half-precision format as a C double.
Expand Down
3 changes: 1 addition & 2 deletions Include/internal/pycore_pymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ extern void _Py_set_387controlword(unsigned short);
// (extended precision), and we don't know how to change
// the rounding precision.
#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \
!defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \
!defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)
!defined(DOUBLE_IS_BIG_ENDIAN_IEEE754)
# define _PY_SHORT_FLOAT_REPR 0
#endif

Expand Down
8 changes: 4 additions & 4 deletions Include/internal/pycore_runtime_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern "C" {
#include "pycore_debug_offsets.h" // _Py_DebugOffsets_INIT()
#include "pycore_dtoa.h" // _dtoa_state_INIT()
#include "pycore_faulthandler.h" // _faulthandler_runtime_state_INIT
#include "pycore_floatobject.h" // _py_float_format_unknown
#include "pycore_floatobject.h" // _py_float_format_*
#include "pycore_function.h"
#include "pycore_hamt.h" // _PyHamt_BitmapNode_Type
#include "pycore_import.h" // IMPORTS_INIT
Expand Down Expand Up @@ -85,8 +85,8 @@ extern PyTypeObject _PyExc_MemoryError;
.is_global = 1, \
}, \
.float_state = { \
.float_format = _py_float_format_unknown, \
.double_format = _py_float_format_unknown, \
.float_format = _py_float_format_ieee_little_endian, \
Comment thread
skirpichev marked this conversation as resolved.
Outdated
.double_format = _py_float_format_ieee_little_endian, \
}, \
.types = { \
.next_version_tag = _Py_TYPE_VERSION_NEXT, \
Expand Down Expand Up @@ -233,4 +233,4 @@ extern PyTypeObject _PyExc_MemoryError;
#ifdef __cplusplus
}
#endif
#endif /* !Py_INTERNAL_RUNTIME_INIT_H */
#endif /* !Py_INTERNAL_RUNTIME_INIT_H */
1 change: 0 additions & 1 deletion Include/internal/pycore_runtime_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ struct _pymem_allocators {
};

enum _py_float_format_type {
_py_float_format_unknown,
_py_float_format_ieee_big_endian,
_py_float_format_ieee_little_endian,
};
Expand Down
1 change: 0 additions & 1 deletion Include/pymacconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#undef SIZEOF_UINTPTR_T
#undef SIZEOF_PTHREAD_T
#undef WORDS_BIGENDIAN
#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754
#undef DOUBLE_IS_BIG_ENDIAN_IEEE754
#undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754
#undef HAVE_GCC_ASM_FOR_X87
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove support for ancient ARM platforms, using mixed-endian representation
for doubles. Patch by Sergey B Kirpichev.
4 changes: 2 additions & 2 deletions Objects/clinic/floatobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading