sleef-trig 0.1.0

Port of a few sleef.org trigonometric functions
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented0 out of 0 items with examples
  • Size
  • Source code size: 218.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.86 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • greatest-ape/sleef-trig
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • greatest-ape

sleef-trig

CI

Rust port of a few SLEEF trigonometric functions:

  • Sleef_sind1_u35purec (approximately 15-30% slower than original)
  • Sleef_sind2_u35sse2 (approximately 15-20% slower than original)
  • Sleef_sind4_u35avx (approximately 5-10% slower than original)

The performance differences are the largest for inputs with high absolute values, notably equal to or greater than 1e14.

Additionally, a couple of functions only valid for inputs between -125.0 and 125.0 are provided:

  • Sleef_sinf1_u35purec_range125
  • Sleef_cosf1_u35purec_range125

Both are around 30x faster than the equivalent (unlimited range) sleef functions.

Usage

To use this crate, add sleef-trig as a dependency to your Cargo.toml file.

For optimal performance, compile sleef-trig with codegen-units = 1 by adding the following to Cargo.toml (once for each performance sensitive profile):

[profile.release.package.sleef-trig]
codegen-units = 1

Running tests and benchmarks

Run:

cargo test
cargo bench

Running tests and benchmarks requires nightly Rust and relies on sleef-trig-sys for SLEEF bindings.

Why not just link to SLEEF?

SIMD FFI is unstable and relies on undefined behaviour.