Skip to content

Commit 7a5a4bf

Browse files
committed
updated readme and tests as per sleef 3.8
1 parent cb6d7c4 commit 7a5a4bf

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

quaddtype/README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Numpy-QuadDType
22

3+
A cross-platform Quad (128-bit) float Data-Type for NumPy.
4+
35
## Installation
46

5-
```
6-
pip install numpy==2.1.0
7-
pip install -i https://test.pypi.org/simple/ quaddtype
7+
```bash
8+
pip install numpy
9+
pip install numpy-quaddtype
810
```
911

1012
## Usage
@@ -21,38 +23,32 @@ np.array([1,2,3], dtype=QuadPrecDType("sleef"))
2123
np.array([1,2,3], dtype=QuadPrecDType("longdouble"))
2224
```
2325

24-
## Install from source
26+
## Installation from source
2527

2628
The code needs the quad precision pieces of the sleef library, which
2729
is not available on most systems by default, so we have to generate
2830
that first. The below assumes one has the required pieces to build
2931
sleef (cmake and libmpfr-dev), and that one is in the package
3032
directory locally.
3133

32-
```
33-
git clone https://github.com/shibatch/sleef.git
34+
```bash
35+
git clone --branch 3.8 https://github.com/shibatch/sleef.git
3436
cd sleef
3537
cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
3638
cmake --build build/ --clean-first -j
3739
cd ..
3840
```
3941

40-
In principle, one can now install this system-wide, but easier would
41-
seem to use the version that was just created, as follows:
42-
```
42+
Building the `numpy-quaddtype` package from locally installed sleef:
43+
```bash
4344
export SLEEF_DIR=$PWD/sleef/build
4445
export LIBRARY_PATH=$SLEEF_DIR/lib
4546
export C_INCLUDE_PATH=$SLEEF_DIR/include
4647
export CPLUS_INCLUDE_PATH=$SLEEF_DIR/include
47-
python3 -m venv temp
48-
source temp/bin/activate
48+
49+
# Install the package
4950
pip install meson-python numpy pytest
5051
pip install -e . -v --no-build-isolation
5152
export LD_LIBRARY_PATH=$SLEEF_DIR/lib
5253
```
5354

54-
Here, we created an editable install on purpose, so one can just work
55-
from the package directory if needed, e.g., to run the tests with,
56-
```
57-
python -m pytest
58-
```

quaddtype/tests/test_quaddtype.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ def test_unary_ops(op, val, expected):
7070

7171
assert result == expected_val, f"{op}({val}) should be {expected}, but got {result}"
7272

73+
def test_inf():
74+
assert QuadPrecision("inf") > QuadPrecision("1e1000")
75+
assert QuadPrecision("-inf") < QuadPrecision("-1e1000")
76+
7377

7478
def test_dtype_creation():
7579
dtype = QuadPrecDType()

0 commit comments

Comments
 (0)