#convert #integer #floating #float #conversion #floating-point

fast-float-to-integer

Convert floating point values to integer types faster than the standard as operator

1 unstable release

new 0.1.0 Nov 10, 2024

#34 in #floating

Download history 63/week @ 2024-11-05

63 downloads per month

MPL-2.0 license

20KB
335 lines

Convert floating point values to integer types faster than the standard as operator.

See the library documentation for documentation targeting users of the library.


Development

We use the xtask pattern to implement automation tasks in Rust rather than shell scripts. This provides an easy way to compile for different targets and run the tests through qemu.

CI enforces that all targets compile, pass tests, and that the generated assembly committed to the repository is up to date.

Releasing

  • Update the changelog.
  • Update the version in Cargo.toml.
  • Create a git tag for the version.
  • Publish to crates.io.

Improvements

More targets

We should add common targets like aarch64.

AVX512

AVX512 can convert float to u64 in one instruction, but the intrinsics are not stable.

We should make sure that AVX512 is actually faster in practice than the current approach.

Cross compilation

The current cross compilation setup is brittle. It assume the host is x86 and that all the targets are x86 variants. This breaks for other architectures like aarch64 that need a custom linker. See the following links for more information:

We should improve this setup. Either setup the linking tools manually or use cargo cross.

Dependencies

~4KB