summaryrefslogtreecommitdiff
path: root/dev-python/gfloat
diff options
context:
space:
mode:
authorCrucible <crucible@localhost>2026-09-24 16:55:33 -0500
committerCrucible <crucible@localhost>2026-09-24 16:55:33 -0500
commit6295f37a70d50a32011b5a1ee7793fea329cd5f2 (patch)
tree11a38d28475be98b7cf8226e8aa2a95aeb7d771e /dev-python/gfloat
parent2c54208beece2b6a1243a50c850e195d1a42d716 (diff)
downloadsrcux-6295f37a70d50a32011b5a1ee7793fea329cd5f2.tar.gz
srcux-6295f37a70d50a32011b5a1ee7793fea329cd5f2.tar.xz
srcux-6295f37a70d50a32011b5a1ee7793fea329cd5f2.zip
Publish srcux candidate 0000000383-20260924-165302
Diffstat (limited to 'dev-python/gfloat')
-rw-r--r--dev-python/gfloat/files/gfloat-0.5.2-signed-zero-overflow.patch51
-rw-r--r--dev-python/gfloat/gfloat-0.5.2-r1.ebuild6
-rw-r--r--dev-python/gfloat/gfloat-0.5.2-r2.ebuild79
3 files changed, 3 insertions, 133 deletions
diff --git a/dev-python/gfloat/files/gfloat-0.5.2-signed-zero-overflow.patch b/dev-python/gfloat/files/gfloat-0.5.2-signed-zero-overflow.patch
deleted file mode 100644
index fd011671ecfe..000000000000
--- a/dev-python/gfloat/files/gfloat-0.5.2-signed-zero-overflow.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 575ceff2babe3e54795ec4ce441ec8e981462f9b Mon Sep 17 00:00:00 2001
-From: Andrew Fitzgibbon <awf@fitzgibbon.ie>
-Date: Fri, 18 Sep 2026 15:58:51 +0100
-Subject: [PATCH] Fix binary64 ndarray encoding overflow for signed zero
-
----
- src/gfloat/encode_ndarray.py | 5 ++++-
- test/test_encode.py | 17 +++++++++++++++++
- 2 files changed, 21 insertions(+), 1 deletion(-)
-
-diff --git a/src/gfloat/encode_ndarray.py b/src/gfloat/encode_ndarray.py
-index af883e4..3d5981c 100644
---- a/src/gfloat/encode_ndarray.py
-+++ b/src/gfloat/encode_ndarray.py
-@@ -51,7 +51,10 @@ def encode_ndarray(fi: FormatInfo, v: npt.NDArray) -> npt.NDArray:
-
- if fi.has_zero:
- if fi.has_nz:
-- code[v == 0] = np.where(sign[v == 0], fi.code_of_negzero, fi.code_of_zero)
-+ # binary64's negative-zero code exceeds the signed int64 range.
-+ code[v == 0] = np.where(
-+ sign[v == 0], np.uint64(fi.code_of_negzero), np.uint64(fi.code_of_zero)
-+ )
- else:
- code[v == 0] = fi.code_of_zero
-
-diff --git a/test/test_encode.py b/test/test_encode.py
-index efdaa1f..8ab344f 100644
---- a/test/test_encode.py
-+++ b/test/test_encode.py
-@@ -62,3 +62,20 @@ def test_encode_edges(fi: FormatInfo, enc: Callable) -> None:
- if fi.domain == Domain.Extended
- else fi.code_of_nan if fi.num_nans > 0 else fi.code_of_min
- )
-+
-+
-+@pytest.mark.parametrize(
-+ "values",
-+ [
-+ [0.0, -0.0],
-+ [[-0.0, 0.0], [1.0, -1.0]],
-+ [1.0, -1.0], # The zero selection is empty, as in issue #63.
-+ [],
-+ ],
-+)
-+def test_encode_binary64_signed_zero(values: npt.ArrayLike) -> None:
-+ v = np.array(values, dtype=np.float64)
-+ codes = encode_ndarray(format_info_binary64, v)
-+ assert codes.dtype == np.dtype(np.uint64)
-+ assert codes.shape == v.shape
-+ np.testing.assert_array_equal(codes, v.view(np.uint64))
diff --git a/dev-python/gfloat/gfloat-0.5.2-r1.ebuild b/dev-python/gfloat/gfloat-0.5.2-r1.ebuild
index bf081ec3b862..b545ecf5f33e 100644
--- a/dev-python/gfloat/gfloat-0.5.2-r1.ebuild
+++ b/dev-python/gfloat/gfloat-0.5.2-r1.ebuild
@@ -26,16 +26,16 @@ RDEPEND="
"
BDEPEND="
test? (
- dev-python/jinja2[${PYTHON_USEDEP}]
dev-python/matplotlib[${PYTHON_USEDEP}]
dev-python/ml-dtypes[${PYTHON_USEDEP}]
dev-python/tabulate[${PYTHON_USEDEP}]
test-rust? (
dev-python/nbval[${PYTHON_USEDEP}]
)
- !arm? ( !x86? (
+ !arm? (
+ dev-python/jinja2[${PYTHON_USEDEP}]
dev-python/pandas[${PYTHON_USEDEP}]
- ) )
+ )
)
"
diff --git a/dev-python/gfloat/gfloat-0.5.2-r2.ebuild b/dev-python/gfloat/gfloat-0.5.2-r2.ebuild
deleted file mode 100644
index 52a0a20c2d05..000000000000
--- a/dev-python/gfloat/gfloat-0.5.2-r2.ebuild
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright 2024-2026 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{13..14} )
-
-inherit distutils-r1 pypi
-
-DESCRIPTION="Generic floating-point types in Python"
-HOMEPAGE="
- https://github.com/graphcore-research/gfloat/
- https://pypi.org/project/gfloat/
-"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
-IUSE="test-rust"
-
-RDEPEND="
- dev-python/array-api-compat[${PYTHON_USEDEP}]
- dev-python/more-itertools[${PYTHON_USEDEP}]
- dev-python/numpy[${PYTHON_USEDEP}]
-"
-BDEPEND="
- test? (
- dev-python/jinja2[${PYTHON_USEDEP}]
- dev-python/matplotlib[${PYTHON_USEDEP}]
- dev-python/ml-dtypes[${PYTHON_USEDEP}]
- dev-python/tabulate[${PYTHON_USEDEP}]
- test-rust? (
- dev-python/nbval[${PYTHON_USEDEP}]
- )
- !arm? ( !x86? (
- dev-python/pandas[${PYTHON_USEDEP}]
- ) )
- )
-"
-
-EPYTEST_PLUGINS=()
-distutils_enable_tests pytest
-
-PATCHES=(
- # https://github.com/graphcore-research/gfloat/pull/60
- "${FILESDIR}/${P}-32bit.patch"
- # https://github.com/graphcore-research/gfloat/pull/64
- "${FILESDIR}/${P}-signed-zero-overflow.patch"
-)
-
-python_test() {
- local EPYTEST_IGNORE=(
- # requires array-api-strict (probably not very valuable downstream)
- test/test_array_api.py
- # require jax
- docs/source/03-value-tables.ipynb
- docs/source/04-benchmark.ipynb
- test/test_jax.py
- # requires mx (possibly git version), torch
- test/test_microxcaling.py
- # requires torch
- test/test_torch.py
- )
-
- if ! has_version "dev-python/jinja2[${PYTHON_USEDEP}]" ||
- ! has_version "dev-python/pandas[${PYTHON_USEDEP}]"
- then
- EPYTEST_IGNORE+=(
- docs/source
- )
- fi
-
- if has_version "dev-python/nbval[${PYTHON_USEDEP}]"; then
- epytest -p nbval
- else
- epytest -o addopts=
- fi
-}