Julia wrapper for SLEEF - SIMD Library for Evaluating Elementary Functions (NB: this library exists only for evaluating LibM.jl and the pure Julia Sleef.jl implementation))



Coverage Status


This is a julia binding for Naoki Shibata's SLEEF

In this library, functions for evaluating some elementary functions are implemented. The algorithm is intentended for efficient evaluation utilizing SIMD instruction sets ...

Right now the following instruction sets are supported:

  • sse2
  • avx
  • avx2
  • fma4
  • and the fall back to purec

ARM neon is not currently supported.

During the build process, we attempt to detect your processor's support for the various SIMD instruction sets, and enable the most powerful it supports. There may be some bugs with this, I am no SIMD expert. Please make a bug report with any issues found. You can override the SIMD instruction set selection by setting the enviroment variable JLSLEEF_ARCH to one of the instruction sets (or purec above), and rebuilding. Either by running deps/rebuild.jl or by reinstalling the package. This enviroment variable only needs to be set during the build process.

It does not currently build for windows. It should be fairly easy to make it build for window, raise an Issue if you actually want to use this on windows, and I'll see what I can do.

Functions named are prefixed with an x, vs usual libm names. Using multiple dispatch, Float32, and Float64 functions share the same names.

In general all functions are accurate to within 1ulp. The functions: xsin_u1, xcos_u1, xtan_u1, xasin_u1, xacos_u1, xatan_u1, xlog_u1, xcbrt_u1, xsincos_u1, xatan2_u1, are varitations on xsin, xcos, xtan etc that are within 1ulp; Their base forms are accurate to within 2ulp (AFAICT). Functions without this varientent form (eg xexp) are already accurace to within 1ulp (also AFAICT).

xilogb is only available with Float64, idk why, its just not defined in SLEEF for single precision floats.

See Also

First Commit


Last Touched

8 months ago


51 commits

Used By: