From 9e8a20dc5d5f0fa0034fea60bd660e7ef9ffacdf Mon Sep 17 00:00:00 2001 From: Luciano Paz Date: Wed, 20 May 2020 11:15:23 +0200 Subject: [PATCH] Drop support for float128 outside of linux and mac (#3930) * Drop support for float128 outside of linux and mac * Improve release notes --- RELEASE-NOTES.md | 1 + pymc3/distributions/dist_math.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 490f905dea..5b2824d882 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -28,6 +28,7 @@ pointwise log likelihood (see [#3883](https://github.com/pymc-devs/pymc3/pull/3883)). - The multiprocessing start method on MacOS is now set to "forkserver", to avoid crashes (see issue [#3849](https://github.com/pymc-devs/pymc3/issues/3849), solved by [#3919](https://github.com/pymc-devs/pymc3/pull/3919)). - Forced the `Beta` distribution's `random` method to generate samples that are in the open interval $(0, 1)$, i.e. no value can be equal to zero or equal to one (issue [#3898](https://github.com/pymc-devs/pymc3/issues/3898) fixed by [#3924](https://github.com/pymc-devs/pymc3/pull/3924)). +- Fixed an issue that happened on Windows, that was introduced by the clipped beta distribution rvs function ([#3924](https://github.com/pymc-devs/pymc3/pull/3924)). Windows does not support the `float128` dtype, but we had assumed that it had to be available. The solution was to only support `float128` on Linux and Darwin systems (see issue [#3929](https://github.com/pymc-devs/pymc3/issues/3849) fixed by [#3930](https://github.com/pymc-devs/pymc3/pull/3930)). ### Deprecations - Remove `sample_ppc` and `sample_ppc_w` that were deprecated in 3.6. diff --git a/pymc3/distributions/dist_math.py b/pymc3/distributions/dist_math.py index 2a7e5c1bb9..b7e5c5b4cd 100644 --- a/pymc3/distributions/dist_math.py +++ b/pymc3/distributions/dist_math.py @@ -17,6 +17,7 @@ @author: johnsalvatier ''' +import platform import numpy as np import scipy.linalg import scipy.stats @@ -36,8 +37,13 @@ c = - .5 * np.log(2. * np.pi) _beta_clip_values = { dtype: (np.nextafter(0, 1, dtype=dtype), np.nextafter(1, 0, dtype=dtype)) - for dtype in ["float16", "float32", "float64", "float128"] + for dtype in ["float16", "float32", "float64"] } +if platform.system() in ["Linux", "Darwin"]: + _beta_clip_values["float128"] = ( + np.nextafter(0, 1, dtype="float128"), + np.nextafter(1, 0, dtype="float128") + )