[Python-ideas] Way to check for floating point "closeness"?

Andrew Barnert abarnert at yahoo.com
Thu Jan 15 04:38:36 CET 2015

On Jan 14, 2015, at 18:27, Andrew Barnert <abarnert at yahoo.com.dmarc.invalid> wrote:

> However, finding an interval math library that handles all of the mathematical operations you want for a particular application may not be easy. You might have to ctypes or wrap up a C or C++ library instead. (I'm just guessing, but I suspect more people have written wrappers for such libs to work with numpy/scipy than with native Python scalars.)

I found a few things on PyPI that look promising, but not a single one of them installs and runs for me on either 2.7 or 3.4.

But I was able to fix up the first one pretty quickly; see https://github.com/abarnert/pyinterval for a fork. You'll need to install crlibm first, but that's trivial on at least Mac/Homebrew and Fedora, so I'm guessing most other *nix systems.

One big thing it's missing is pow (and, in fact, all bivariate functions). Of course you can always define it as exp(log(base) * exponent), but IIRC that gives much wider error bars than a proper interval power function.

More information about the Python-ideas mailing list