diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0d32495..29527e4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,12 +81,12 @@ jobs: then rm -r build fi - meson setup build -Db_sanitize=address,undefined + meson setup build python -m build --no-isolation --wheel -Cbuilddir=build --config-setting='compile-args=-v' -Csetup-args="-Dbuildtype=debug" find ./dist/*.whl | xargs python -m pip install - name: Run stringdtype tests working-directory: stringdtype run: | - ASAN_OPTIONS=detect_leaks=false LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so pytest -s -vvv --color=yes + pytest -s -vvv --color=yes pip uninstall -y pandas - ASAN_OPTIONS=detect_leaks=false LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so pytest -s -vvv --color=yes + pytest -s -vvv --color=yes diff --git a/quaddtype/README.md b/quaddtype/README.md index 60693cb9..bd067384 100644 --- a/quaddtype/README.md +++ b/quaddtype/README.md @@ -20,3 +20,39 @@ np.array([1,2,3], dtype=QuadPrecDType("sleef")) # using longdouble backend np.array([1,2,3], dtype=QuadPrecDType("longdouble")) ``` + +## Install from source + +The code needs the quad precision pieces of the sleef library, which +is not available on most systems by default, so we have to generate +that first. The below assumes one has the required pieces to build +sleef (cmake and libmpfr-dev), and that one is in the package +directory locally. + +``` +git clone https://github.com/shibatch/sleef.git +cd sleef +cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON +cmake --build build/ --clean-first -j +cd .. +``` + +In principle, one can now install this system-wide, but easier would +seem to use the version that was just created, as follows: +``` +export SLEEF_DIR=$PWD/sleef/build +export LIBRARY_PATH=$SLEEF_DIR/lib +export C_INCLUDE_PATH=$SLEEF_DIR/include +export CPLUS_INCLUDE_PATH=$SLEEF_DIR/include +python3 -m venv temp +source temp/bin/activate +pip install meson-python numpy pytest +pip install -e . -v --no-build-isolation +export LD_LIBRARY_PATH=$SLEEF_DIR/lib +``` + +Here, we created an editable install on purpose, so one can just work +from the package directory if needed, e.g., to run the tests with, +``` +python -m pytest +``` diff --git a/quaddtype/tests/test_quaddtype.py b/quaddtype/tests/test_quaddtype.py index 11cf7671..38d32fb1 100644 --- a/quaddtype/tests/test_quaddtype.py +++ b/quaddtype/tests/test_quaddtype.py @@ -72,8 +72,10 @@ def test_unary_ops(op, val, expected): def test_nan_and_inf(): - assert (QuadPrecision("nan") != QuadPrecision("nan")) == ( - QuadPrecision("nan") == QuadPrecision("nan")) + # NaN should not equal itself + assert QuadPrecision("nan") != QuadPrecision("nan") + + # Test infinity comparisons assert QuadPrecision("inf") > QuadPrecision("1e1000") assert QuadPrecision("-inf") < QuadPrecision("-1e1000")