#ieee-754 #reference #float #soft #soft-float #python #intends

simple-soft-float

旨在成为IEEE 754标准的简单参考实现的软浮点库。

1个不稳定版本

0.1.0 2019年12月16日

#1891算法


3 个crate中使用

LGPL-2.1-or-later

490KB
7.5K SLoC

Rust 6.5K SLoC // 0.0% comments Shell 1K SLoC // 0.0% comments

旨在成为IEEE 754标准的简单参考实现的软浮点库。

Rust中使用安装

将其添加到您的 Cargo.toml

[dependencies.simple-soft-float]
version = "0.1"

Python中使用安装

使用 rustup.rs 安装Rust。

创建CPython 3.6到3.7虚拟环境(不确定3.8是否支持)。

安装Python绑定构建工具

pip install maturin

获取源代码

git clone https://salsa.debian.org/Kazan-team/simple-soft-float.git
cd simple-soft-float

将源目录更改为使用特定的Rust nightly版本:(必须在 simple-soft-float 目录中)

rustup override set nightly-2019-07-19

构建和测试(类似于 setup.py develop

cargo test --features python # runs tests from Rust
# build and install to python
maturin develop --cargo-extra-args="--features python-extension"
python -m unittest # runs smoke tests from Python

构建Rust文档

cargo doc --features python # ignore warning about rand_core name collision
open docs in default browser:
xdg-open target/doc/simple_soft_float/struct.DynamicFloat.html

构建Python文档

pip install pdoc3
pdoc3 simple_soft_float --html -o target/python-docs
xdg-open target/python-docs/simple_soft_float.html

依赖关系

~1.7–2.6MB
~56K SLoC