safeeft

Crates.iosafeeft
lib.rssafeeft
version0.0.5
sourcesrc
created_at2017-11-23 11:11:27.658747
updated_at2017-12-13 01:13:45.697704
descriptionSafe and branchless error-free transformation algorithms for floating point numbers.
homepage
repositoryhttps://github.com/GNQG/safeeft
max_upload_size
id40312
size25,845
(GNQG)

documentation

README

safeeft

Safe and branchless error-free transformation algorithms for floating point numbers.

Now supports types which impl num_traits::Float and size of bits of its significand is odd (Because Float does not offer its size).

Documents

Benchmark

With nightly compiler, execute

$ cargo +nightly bench

If your CPU has fma target-feature,

$ RUSTFLAGS='-C target-cpu=native' cargo +nightly bench --features use-fma

If your CPU does not have fma and compile and run with this command, ***_fma will work very slowly due to software emulation of fma.

Sample result

  • compiler: rustc 1.23.0-nightly
  • CPU: Intel Core i5-4570(Haswell)@3.20GHz

twosum

algorithm time (ns) / operation
twosum(not safe) 1.7530
safetwosum_branch 4.4827
safetwosum_straight 4.6438
safetwosum_fma 2.4749

split

algorithm time (ns) / operation
split(not safe) 0.8915
safesplit_branch(not safe) 1.1918
safesplit_straight 3.3454

twoproduct

algorithm time (ns) / operation
twoproduct(not safe) 2.9322
safetwoproduct_branch 3.7826
safetwoproduct_straight 12.9883
safetwoproduct_fma 0.7125
Commit count: 19

cargo fmt