Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greatest-ape/sleef-trig
https://github.com/greatest-ape/sleef-trig
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/greatest-ape/sleef-trig
- Owner: greatest-ape
- License: bsl-1.0
- Created: 2022-09-20T18:42:00.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-01T13:21:38.000Z (about 2 years ago)
- Last Synced: 2024-09-13T23:24:40.490Z (2 months ago)
- Language: C
- Size: 430 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# sleef-trig
[![CI](https://github.com/greatest-ape/sleef-trig/actions/workflows/ci.yml/badge.svg)](https://github.com/greatest-ape/sleef-trig/actions/workflows/ci.yml)
Rust port of a few [SLEEF](https://sleef.org) 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):```toml
[profile.release.package.sleef-trig]
codegen-units = 1
```### Running tests and benchmarks
Run:
```sh
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](https://github.com/rust-lang/rust/issues/63068).