Skip to content

mathspace/pycrlibm

Repository files navigation

PyCRlibm - Python bindings for CRlibm

Travis CI build status (Linux)AppVeyor CI build status (Windows)Latest PyPI versionDocumentation Status

Python bindings for CRlibm, an efficient and proven correctly-rounded mathematical library.

CRlibm is a free mathematical library (libm) which provides:

  • implementations of the double-precision C99 standard elementary functions,
  • correctly rounded in the four IEEE-754 rounding modes,
  • with a comprehensive proof of both the algorithms used and their implementation,
  • sufficiently efficient in average time, worst-case time, and memory consumption to replace existing libms transparently.

Installation

At the command line:

$ pip install crlibm 

On Microsoft Windows pip will try first to download a binary archive in wheel format, and if no such a wheel can be found for your Python version, pip will try to compile the library. In order to do so, it is strongly recommended to have MinGW-w64 installed under MSYS2, for instance by following the instructions in http://stackoverflow.com/a/30071634.

Usage

In Python:

>>> import crlibm >>> crlibm.exp_ru(1) 2.7182818284590455 >>> crlibm.exp_rd(1) 2.718281828459045 

Features

  • This project provides the bindings for the functions in the following table:
f(x)Round to nearestRound up (to +∞)Round down (to -∞)Round to 0
Exponentials and logarithms
exp(x)exp_rnexp_ruexp_rdexp_rz
exp(x)-1expm1_rnexpm1_ruexpm1_rdexpm1_rz
log(x)log_rnlog_rulog_rdlog_rz
log(1+x)log1p_rnlog1p_rulog1p_rdlog1p_rz
log(x)/log(2)log2_rnlog2_rulog2_rdlog2_rz
log(x)/log(10)log10_rnlog10_rulog10_rdlog10_rz
sinh(x)sinh_rnsinh_rusinh_rdsinh_rz
cosh(x)cosh_rncosh_rucosh_rdcosh_rz
Trigonometry
sin(x)sin_rnsin_rusin_rdsin_rz
cos(x)cos_rncos_rucos_rdcos_rz
tan(x)tan_rntan_rutan_rdtan_rz
asin(x)asin_rnasin_ruasin_rdasin_rz
acos(x)acos_rnacos_ruacos_rdacos_rz
atan(x)atan_rnatan_ruatan_rdatan_rz
Trigonometry in multiples of π
sin(π * x)sinpi_rnsinpi_rusinpi_rdsinpi_rz
cos(π * x)cospi_rncospi_rucospi_rdcospi_rz
tan(π * x)tanpi_rntanpi_rutanpi_rdtanpi_rz
asin(x)/πasinpi_rnasinpi_ruasinpi_rdasinpi_rz
acos(x)/πacospi_rnacospi_ruacospi_rdacospi_rz
atan(x)/πatanpi_rnatanpi_ruatanpi_rdatanpi_rz
  • The function pow in CRlibm is not exported.

License

Both the CRlibm library and the Python bindings are distributed under the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Authors

David Defour, Catherine Daramy, Florent de Dinechin, Matthieu Gallet, Nicolas Gast, Christoph Lauter, Jean-Michel Muller.

Python bindings by Stefano Taschini.

Links

About

Python bindings for CRlibm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C77.2%
  • TeX14.7%
  • JetBrains MPS4.8%
  • Makefile1.9%
  • Shell0.9%
  • Python0.2%
  • Other0.3%