Skip to content

Commit 59c8612

Browse files
committed
Merge branch 'main' into hash
2 parents d8b67cf + 345b596 commit 59c8612

File tree

8 files changed

+41
-15
lines changed

8 files changed

+41
-15
lines changed

.github/workflows/big_endian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949

5050
name: "${{ matrix.BUILD_PROP[0] }}"
5151
steps:
52-
- uses: actions/checkout@v5
52+
- uses: actions/checkout@v6
5353
with:
5454
submodules: recursive
5555
fetch-tags: true

.github/workflows/build_wheels.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: Build wheels on Linux
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v5
23+
- uses: actions/checkout@v6
2424

2525
- name: Set up Python
2626
uses: actions/setup-python@v6
@@ -74,7 +74,7 @@ jobs:
7474
os: [macos-14, macos-15, macos-15-intel]
7575

7676
steps:
77-
- uses: actions/checkout@v5
77+
- uses: actions/checkout@v6
7878

7979
- name: Set up Python
8080
uses: actions/setup-python@v6
@@ -139,7 +139,7 @@ jobs:
139139
architecture: [x64]
140140

141141
steps:
142-
- uses: actions/checkout@v5
142+
- uses: actions/checkout@v6
143143

144144
- name: Setup MSVC
145145
uses: ilammy/msvc-dev-cmd@v1
@@ -194,7 +194,7 @@ jobs:
194194
name: Build SDist
195195
runs-on: ubuntu-latest
196196
steps:
197-
- uses: actions/checkout@v5
197+
- uses: actions/checkout@v6
198198

199199
- name: Set up Python
200200
uses: actions/setup-python@v6

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1616
- name: Setup Python
1717
uses: actions/setup-python@v6
1818
with:

.github/workflows/typecheck.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
timeout-minutes: 2
2121

2222
steps:
23-
- uses: actions/checkout@v5
23+
- uses: actions/checkout@v6
2424

25-
- uses: astral-sh/[email protected].3
25+
- uses: astral-sh/[email protected].4
2626
with:
2727
activate-environment: true
2828
python-version: "3.11"

quaddtype/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ Building the `numpy-quaddtype` package:
4242
python3 -m venv temp
4343
source temp/bin/activate
4444

45-
# Install the package
46-
pip install numpy pytest
45+
# Install NumPy from source
46+
pip install "numpy @ git+https://github.com/numpy/numpy.git"
47+
48+
# Install build and test dependencies
49+
pip install pytest meson meson-python
4750

4851
# To build without QBLAS (default for MSVC)
4952
# export CFLAGS="-DDISABLE_QUADBLAS"

quaddtype/meson.build

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,23 @@ if sleef_dep.found() and sleef_dep.type_name() != 'internal'
5050
)
5151
use_system_sleef = true
5252
else
53-
fallback_reason = 'quad-precision support is not working'
53+
fallback_reason = 'System-wide SLEEF installation found but a test for quad precision support failed.'
5454
endif
5555
else
56-
fallback_reason = 'sleefquad library is missing'
56+
fallback_reason = 'System-wide SLEEF installation does not have a sleefquad library.'
5757
endif
5858
else
59-
fallback_reason = 'SLEEF not found system-wide'
59+
fallback_reason = 'Cannot find system-wide SLEEF installation.'
6060
endif
6161

6262
if use_system_sleef
6363
message('Using system-wide SLEEF installation with quad-precision support')
6464
else
65-
warning('Falling back to SLEEF subproject: ' + fallback_reason)
6665
sleef_subproj = subproject('sleef')
6766
sleef_dep = sleef_subproj.get_variable('sleef_dep')
6867
sleefquad_dep = sleef_subproj.get_variable('sleefquad_dep')
69-
message('Using SLEEF subproject')
68+
warning(fallback_reason)
69+
message('Proceeding with vendored SLEEF subproject instead')
7070
endif
7171

7272
incdir_numpy = run_command(py,

quaddtype/numpy_quaddtype/src/scalar.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,15 @@ static PyMethodDef QuadPrecision_methods[] = {
605605
{NULL, NULL, 0, NULL} /* Sentinel */
606606
};
607607

608+
static PyObject *
609+
QuadPrecision_get_dtype(QuadPrecisionObject *self, void *NPY_UNUSED(closure))
610+
{
611+
QuadPrecDTypeObject *dtype = new_quaddtype_instance(self->backend);
612+
return (PyObject *)dtype;
613+
}
614+
608615
static PyGetSetDef QuadPrecision_getset[] = {
616+
{"dtype", (getter)QuadPrecision_get_dtype, NULL, "Data type descriptor for this scalar", NULL},
609617
{"real", (getter)QuadPrecision_get_real, NULL, "Real part of the scalar", NULL},
610618
{"imag", (getter)QuadPrecision_get_imag, NULL, "Imaginary part of the scalar (always 0 for real types)", NULL},
611619
{NULL} /* Sentinel */

quaddtype/tests/test_quaddtype.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,6 +4294,21 @@ def test_as_integer_ratio_compatibility_with_float(self, value):
42944294
float_ratio = float_num / float_denom
42954295
assert abs(quad_ratio - float_ratio) < 1e-15
42964296

4297+
def test_quadprecision_scalar_dtype_expose():
4298+
quad_ld = QuadPrecision("1e100", backend="longdouble")
4299+
quad_sleef = QuadPrecision("1e100", backend="sleef")
4300+
assert quad_ld.dtype == QuadPrecDType(backend='longdouble')
4301+
assert np.dtype(quad_ld) == QuadPrecDType(backend='longdouble')
4302+
4303+
#todo: Uncomment them when 232 is merged
4304+
# assert quad_ld.dtype.backend == 1
4305+
# assert np.dtype(quad_ld).backend == 1
4306+
4307+
assert quad_sleef.dtype == QuadPrecDType(backend='sleef')
4308+
assert np.dtype(quad_sleef) == QuadPrecDType(backend='sleef')
4309+
# assert quad_sleef.dtype.backend == 0
4310+
# assert np.dtype(quad_sleef).backend == 0
4311+
42974312

42984313
class TestPickle:
42994314
"""Comprehensive test suite for pickle support in QuadPrecDType."""

0 commit comments

Comments
 (0)