#ieee-754 #ffi #math #cmath #floating-point

fdlibm-rs

rust wrapper of FDLIBM, a C math library for machines that support IEEE-754 floating-point arithmetic

1 unstable release

0.1.0 Sep 29, 2023

#9 in #ieee-754

23 downloads per month

MIT license

270KB
5.5K SLoC

C 5K SLoC // 0.4% comments Rust 684 SLoC // 0.0% comments

Contains (autotools obfuscated code, 98KB) fdlibm/configure

Fdlibm-rs

This crate is a rust wrapper of fdlibm.

Usage

Run the following Cargo command in your project directory:

cargo add fdlibm-rs
use fdlibm_rs::sin;
let value = unsafe {sin(1.0)};
println!("sin(1)={}",value);

Disclaimer

  1. This lib is currently in beta version, some of functions doesn't have unit tests and some are buggy (gamme).
  2. Other modes decribed in fdlibm are not supported yet.

Todo

  1. Avoid using std::, instead use core:: when possible.
  2. Support other targets (currently only x86_64-unknown-linux-gnu is supported)
  3. Support other Modes.
  4. Benchmarks.

No runtime deps

~0–2.5MB
~39K SLoC