build(ariadne): vendor serde crates
This commit was merged in pull request #15.
This commit is contained in:
1 parent
90f46026f0
commit
64773e0948
490 files changed
+175103
No files matched your search
@@ -0,0 +1 @@
|
||||
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"97a320dc3ca5574ec142d18738f57ffb627cf2751f373a98251db59e7a104ca1",".github/workflows/ci.yml":"2d9a2289aa97a6f267a6fef7618641f7e8162c125d15dc3d541654821dfda61b","Cargo.lock":"7b56668e9afc330a532108987c3a9823871b527a36bba1968b5d3e20043d8990","Cargo.toml":"b31420c7a806fae5b9ea2438dd4cbb99dcb3a22da67697fdf2776cc44a69527e","Cargo.toml.orig":"eb5f807eae822d14db0855ecda0291410aeabba2342acab11860526378a97cd7","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"2ea276e5dbe105bd56dfdcf400746d07a70a20cf5f47e76d544054a78cd7e6a6","benches/bench.rs":"28d23a29046c4d50c73a19fd81ad80cc97e474af6d8c30f81dcc8c9621065cca","build.rs":"ad320bc635887879bdbbf1b9322da4a157ec2c5a4243bd7c2cf9b6884a3b2a41","src/lib.rs":"0bdb8cd6a8835af08b5ca60956df283732f1b5aa940c750b1ec5dc78bf245b61","src/stdarch_x86.rs":"b19b4c54f0c08c92f96d18c152f796d85cc17f9e6195f3e7d5612f05f28836fb","src/tests.rs":"7b4c56f3b79836ca00de82952f246a303e7a9754849a6e5939a2c5aa6d62a6fb","src/traits.rs":"c88b2b8282b423cd925f1999e2de9b03cef4d5d4d17b035d20c0708a5692a935","tests/exhaustive.rs":"272912ed5abdd2fa17c27b7323a1061b47a52c878c829f84c300243c4a78efd4","tests/ryu_comparison.rs":"8bd55e9fe7a3121f124180983c319412ce87b886354f3f998da4789f9260fa06","tests/test.rs":"9cd1579f70ba9fa96cb9dcc19d0cfc88f3277878ef6ac121b481aee9cae620e2"},"package":"29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "7b7cc48b58028e8af7be87e94c0c1c8936f1a57c"
|
||||
},
|
||||
"path_in_vcs": ""
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
schedule: [cron: "40 1 * * *"]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
RUSTFLAGS: -Dwarnings
|
||||
|
||||
jobs:
|
||||
pre_ci:
|
||||
uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
|
||||
|
||||
test:
|
||||
name: ${{matrix.os == 'macos' && 'macOS' || format('Rust {0} ({1})', matrix.rust, matrix.arch)}}
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ${{matrix.os == 'macos' && 'macos-latest' || matrix.arch == 'x86_64' && 'ubuntu-latest' || 'ubuntu-24.04-arm'}}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
rust: [nightly, beta, stable, 1.86.0, 1.71.0]
|
||||
arch: [x86_64, aarch64]
|
||||
os: [ubuntu]
|
||||
include:
|
||||
- rust: nightly
|
||||
os: macos
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{matrix.rust}}
|
||||
targets: wasm32-unknown-unknown
|
||||
- name: Enable type layout randomization
|
||||
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
|
||||
if: matrix.rust == 'nightly'
|
||||
- run: cargo check
|
||||
- run: cargo build --tests --features no-panic --release
|
||||
if: matrix.rust == 'nightly'
|
||||
- run: cargo test
|
||||
if: matrix.rust != '1.71.0'
|
||||
- run: cargo test --release
|
||||
if: matrix.rust != '1.71.0'
|
||||
- run: cargo check --target=wasm32-unknown-unknown
|
||||
- run: cargo check
|
||||
env:
|
||||
RUSTFLAGS: ${{env.RUSTFLAGS}} -Ctarget-cpu=native
|
||||
- run: cargo build --tests --features no-panic --release
|
||||
if: matrix.rust == 'nightly'
|
||||
env:
|
||||
RUSTFLAGS: ${{env.RUSTFLAGS}} -Ctarget-cpu=native
|
||||
- run: cargo test
|
||||
if: matrix.rust != '1.71.0'
|
||||
env:
|
||||
RUSTFLAGS: ${{env.RUSTFLAGS}} -Ctarget-cpu=native
|
||||
- run: cargo test --release
|
||||
if: matrix.rust != '1.71.0'
|
||||
env:
|
||||
RUSTFLAGS: ${{env.RUSTFLAGS}} -Ctarget-cpu=native
|
||||
- run: cargo --config='profile.dev.opt-level="s"' check
|
||||
- run: cargo --config='profile.release.opt-level="s"' build --tests --features no-panic --release
|
||||
if: matrix.rust == 'nightly'
|
||||
- run: cargo --config='profile.dev.opt-level="s"' test
|
||||
if: matrix.rust != '1.71.0'
|
||||
- run: cargo --config='profile.release.opt-level="s"' test --release
|
||||
if: matrix.rust != '1.71.0'
|
||||
- run: cargo --config='profile.release.opt-level="s"' check --target=wasm32-unknown-unknown
|
||||
- uses: actions/upload-artifact@v7
|
||||
if: matrix.rust == 'nightly' && matrix.arch == 'x86_64' && matrix.os == 'ubuntu' && always()
|
||||
with:
|
||||
name: Cargo.lock
|
||||
path: Cargo.lock
|
||||
continue-on-error: true
|
||||
|
||||
doc:
|
||||
name: Documentation
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- uses: dtolnay/install@cargo-docs-rs
|
||||
- run: cargo docs-rs
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'pull_request'
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: dtolnay/rust-toolchain@clippy
|
||||
with:
|
||||
targets: aarch64-unknown-linux-gnu
|
||||
- run: cargo clippy --tests --benches -- -Dclippy::all -Dclippy::pedantic
|
||||
- run: cargo clippy --target=aarch64-unknown-linux-gnu -- -Dclippy::all -Dclippy::pedantic
|
||||
- run: cargo clippy -- -Dclippy::all -Dclippy::pedantic
|
||||
env:
|
||||
RUSTFLAGS: ${{env.RUSTFLAGS}} -Ctarget-cpu=native
|
||||
|
||||
miri:
|
||||
name: Miri (${{matrix.name}})
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: 64-bit little endian
|
||||
target: x86_64-unknown-linux-gnu
|
||||
- name: 64-bit little endian, NEON
|
||||
target: aarch64-unknown-linux-gnu
|
||||
- name: 64-bit big endian
|
||||
target: powerpc64-unknown-linux-gnu
|
||||
- name: 32-bit little endian
|
||||
target: i686-unknown-linux-gnu
|
||||
- name: 32-bit big endian
|
||||
target: mips-unknown-linux-gnu
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: dtolnay/rust-toolchain@miri
|
||||
- run: cargo miri setup
|
||||
- run: cargo miri test --target ${{matrix.target}}
|
||||
env:
|
||||
MIRIFLAGS: -Zmiri-strict-provenance
|
||||
|
||||
outdated:
|
||||
name: Outdated
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'pull_request'
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/install@cargo-outdated
|
||||
- run: cargo outdated --exit-code 1
|
||||
- run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1
|
||||
|
||||
fuzz:
|
||||
name: Fuzz
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- uses: dtolnay/install@cargo-fuzz
|
||||
- run: cargo fuzz check
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
###############################################################################
|
||||
# @generated
|
||||
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
|
||||
# regenerate this file, run the following:
|
||||
#
|
||||
# bazel run @@//third_party:vendor_crates
|
||||
###############################################################################
|
||||
|
||||
load(
|
||||
"@rules_rust//cargo:defs.bzl",
|
||||
"cargo_build_script",
|
||||
"cargo_toml_env_vars",
|
||||
)
|
||||
load("@rules_rust//rust:defs.bzl", "rust_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cargo_toml_env_vars(
|
||||
name = "cargo_toml_env_vars",
|
||||
src = "Cargo.toml",
|
||||
)
|
||||
|
||||
rust_library(
|
||||
name = "zmij",
|
||||
srcs = glob(
|
||||
include = ["**/*.rs"],
|
||||
allow_empty = False,
|
||||
),
|
||||
compile_data = glob(
|
||||
include = ["**"],
|
||||
allow_empty = True,
|
||||
exclude = [
|
||||
"**/* *",
|
||||
".tmp_git_root/**/*",
|
||||
"BUILD",
|
||||
"BUILD.bazel",
|
||||
"WORKSPACE",
|
||||
"WORKSPACE.bazel",
|
||||
],
|
||||
),
|
||||
crate_root = "src/lib.rs",
|
||||
edition = "2021",
|
||||
rustc_env_files = [
|
||||
":cargo_toml_env_vars",
|
||||
],
|
||||
rustc_flags = [
|
||||
"--cap-lints=allow",
|
||||
],
|
||||
tags = [
|
||||
"cargo-bazel",
|
||||
"crate-name=zmij",
|
||||
"manual",
|
||||
"noclippy",
|
||||
"norustfmt",
|
||||
],
|
||||
target_compatible_with = select({
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin": [],
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios": [],
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios-macabi": [],
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios-sim": [],
|
||||
"@rules_rust//rust/platform:aarch64-linux-android": [],
|
||||
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [],
|
||||
"@rules_rust//rust/platform:aarch64-unknown-fuchsia": [],
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [],
|
||||
"@rules_rust//rust/platform:aarch64-unknown-none": [],
|
||||
"@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [],
|
||||
"@rules_rust//rust/platform:aarch64-unknown-uefi": [],
|
||||
"@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [],
|
||||
"@rules_rust//rust/platform:arm-unknown-linux-musleabi": [],
|
||||
"@rules_rust//rust/platform:armv7-linux-androideabi": [],
|
||||
"@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [],
|
||||
"@rules_rust//rust/platform:i686-apple-darwin": [],
|
||||
"@rules_rust//rust/platform:i686-linux-android": [],
|
||||
"@rules_rust//rust/platform:i686-pc-windows-msvc": [],
|
||||
"@rules_rust//rust/platform:i686-unknown-freebsd": [],
|
||||
"@rules_rust//rust/platform:i686-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:loongarch64-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:mips-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:riscv32imac-unknown-none-elf": [],
|
||||
"@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [],
|
||||
"@rules_rust//rust/platform:riscv64gc-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [],
|
||||
"@rules_rust//rust/platform:s390x-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:sparc64-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:sparc64-unknown-netbsd": [],
|
||||
"@rules_rust//rust/platform:sparc64-unknown-openbsd": [],
|
||||
"@rules_rust//rust/platform:thumbv6m-none-eabi": [],
|
||||
"@rules_rust//rust/platform:thumbv7em-none-eabi": [],
|
||||
"@rules_rust//rust/platform:thumbv7em-none-eabihf": [],
|
||||
"@rules_rust//rust/platform:thumbv7m-none-eabi": [],
|
||||
"@rules_rust//rust/platform:thumbv8m.main-none-eabi": [],
|
||||
"@rules_rust//rust/platform:thumbv8m.main-none-eabihf": [],
|
||||
"@rules_rust//rust/platform:wasm32-unknown-emscripten": [],
|
||||
"@rules_rust//rust/platform:wasm32-unknown-unknown": [],
|
||||
"@rules_rust//rust/platform:wasm32-wasip1": [],
|
||||
"@rules_rust//rust/platform:wasm32-wasip1-threads": [],
|
||||
"@rules_rust//rust/platform:wasm32-wasip2": [],
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin": [],
|
||||
"@rules_rust//rust/platform:x86_64-apple-ios": [],
|
||||
"@rules_rust//rust/platform:x86_64-apple-ios-macabi": [],
|
||||
"@rules_rust//rust/platform:x86_64-linux-android": [],
|
||||
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [],
|
||||
"@rules_rust//rust/platform:x86_64-unknown-freebsd": [],
|
||||
"@rules_rust//rust/platform:x86_64-unknown-fuchsia": [],
|
||||
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [],
|
||||
"@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [],
|
||||
"@rules_rust//rust/platform:x86_64-unknown-none": [],
|
||||
"@rules_rust//rust/platform:x86_64-unknown-uefi": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
version = "1.0.23",
|
||||
deps = [
|
||||
":build_script_build",
|
||||
],
|
||||
)
|
||||
|
||||
cargo_build_script(
|
||||
name = "_bs",
|
||||
srcs = glob(
|
||||
include = ["**/*.rs"],
|
||||
allow_empty = False,
|
||||
),
|
||||
build_script_env_files = [
|
||||
":cargo_toml_env_vars",
|
||||
],
|
||||
compile_data = glob(
|
||||
include = ["**"],
|
||||
allow_empty = True,
|
||||
exclude = [
|
||||
"**/* *",
|
||||
"**/*.rs",
|
||||
".tmp_git_root/**/*",
|
||||
"BUILD",
|
||||
"BUILD.bazel",
|
||||
"WORKSPACE",
|
||||
"WORKSPACE.bazel",
|
||||
],
|
||||
),
|
||||
crate_name = "build_script_build",
|
||||
crate_root = "build.rs",
|
||||
data = glob(
|
||||
include = ["**"],
|
||||
allow_empty = True,
|
||||
exclude = [
|
||||
"**/* *",
|
||||
".tmp_git_root/**/*",
|
||||
"BUILD",
|
||||
"BUILD.bazel",
|
||||
"WORKSPACE",
|
||||
"WORKSPACE.bazel",
|
||||
],
|
||||
),
|
||||
edition = "2021",
|
||||
emit_warnings = False,
|
||||
pkg_name = "zmij",
|
||||
rustc_env_files = [
|
||||
":cargo_toml_env_vars",
|
||||
],
|
||||
rustc_flags = [
|
||||
"--cap-lints=allow",
|
||||
],
|
||||
tags = [
|
||||
"cargo-bazel",
|
||||
"crate-name=zmij",
|
||||
"manual",
|
||||
"noclippy",
|
||||
"norustfmt",
|
||||
],
|
||||
version = "1.0.23",
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "build_script_build",
|
||||
actual = ":_bs",
|
||||
tags = ["manual"],
|
||||
)
|
||||
+568
@@ -0,0 +1,568 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloca"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anes"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
||||
|
||||
[[package]]
|
||||
name = "cast"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e17dd265a7d0f31ef544e1b20e03add05d3b45b491b633b10d67145d2acc1a38"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "chacha20"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ciborium"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"ciborium-ll",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-io"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-ll"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"half",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "criterion"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3"
|
||||
dependencies = [
|
||||
"alloca",
|
||||
"anes",
|
||||
"cast",
|
||||
"ciborium",
|
||||
"clap",
|
||||
"criterion-plot",
|
||||
"itertools",
|
||||
"num-traits",
|
||||
"oorandom",
|
||||
"page_size",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tinytemplate",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "criterion-plot"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
|
||||
dependencies = [
|
||||
"cast",
|
||||
"itertools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.186"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "no-panic"
|
||||
version = "0.1.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f967505aabc8af5752d098c34146544a43684817cdba8f9725b292530cabbf53"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
version = "11.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
|
||||
|
||||
[[package]]
|
||||
name = "opt-level"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e98329f1048d878d11b28949196b798b93e2f1e0f98121cca55d6b3e1a91030f"
|
||||
|
||||
[[package]]
|
||||
name = "page_size"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
|
||||
dependencies = [
|
||||
"chacha20",
|
||||
"getrandom",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"zmij 1.0.22",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinytemplate"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd2f034a4bebf216c9e4b7083603e024cf930873fd67830cfb083c9fa33129d9"
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.23"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"no-panic",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num_cpus",
|
||||
"opt-level",
|
||||
"rand",
|
||||
"ryu",
|
||||
]
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2021"
|
||||
rust-version = "1.71"
|
||||
name = "zmij"
|
||||
version = "1.0.23"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>"]
|
||||
build = "build.rs"
|
||||
exclude = ["*.png"]
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
||||
autobenches = false
|
||||
description = "A double-to-string conversion algorithm based on Schubfach and xjb"
|
||||
documentation = "https://docs.rs/zmij"
|
||||
readme = "README.md"
|
||||
keywords = ["float"]
|
||||
categories = [
|
||||
"value-formatting",
|
||||
"no-std",
|
||||
"no-std::no-alloc",
|
||||
]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/dtolnay/zmij"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
rustdoc-args = [
|
||||
"--generate-link-to-definition",
|
||||
"--generate-macro-expansion",
|
||||
"--extern-html-root-url=core=https://doc.rust-lang.org",
|
||||
]
|
||||
|
||||
[lib]
|
||||
name = "zmij"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[test]]
|
||||
name = "exhaustive"
|
||||
path = "tests/exhaustive.rs"
|
||||
|
||||
[[test]]
|
||||
name = "ryu_comparison"
|
||||
path = "tests/ryu_comparison.rs"
|
||||
|
||||
[[test]]
|
||||
name = "test"
|
||||
path = "tests/test.rs"
|
||||
|
||||
[[bench]]
|
||||
name = "bench"
|
||||
path = "benches/bench.rs"
|
||||
harness = false
|
||||
|
||||
[dependencies.no-panic]
|
||||
version = "0.1.36"
|
||||
optional = true
|
||||
|
||||
[dev-dependencies.num-bigint]
|
||||
version = "0.5"
|
||||
|
||||
[dev-dependencies.num-integer]
|
||||
version = "0.1"
|
||||
|
||||
[dev-dependencies.num_cpus]
|
||||
version = "1.8"
|
||||
|
||||
[dev-dependencies.opt-level]
|
||||
version = "1"
|
||||
|
||||
[dev-dependencies.rand]
|
||||
version = "0.10"
|
||||
|
||||
[dev-dependencies.ryu]
|
||||
version = "1"
|
||||
|
||||
[target."cfg(not(miri))".dev-dependencies.criterion]
|
||||
version = "0.8"
|
||||
default-features = false
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
[package]
|
||||
name = "zmij"
|
||||
version = "1.0.23"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>"]
|
||||
categories = ["value-formatting", "no-std", "no-std::no-alloc"]
|
||||
description = "A double-to-string conversion algorithm based on Schubfach and xjb"
|
||||
documentation = "https://docs.rs/zmij"
|
||||
edition = "2021"
|
||||
exclude = ["*.png"]
|
||||
keywords = ["float"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/dtolnay/zmij"
|
||||
rust-version = "1.71"
|
||||
|
||||
[dependencies]
|
||||
no-panic = { version = "0.1.36", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
num-bigint = "0.5"
|
||||
num_cpus = "1.8"
|
||||
num-integer = "0.1"
|
||||
opt-level = "1"
|
||||
rand = "0.10"
|
||||
ryu = "1"
|
||||
|
||||
[target.'cfg(not(miri))'.dev-dependencies]
|
||||
criterion = { version = "0.8", default-features = false }
|
||||
|
||||
[[bench]]
|
||||
name = "bench"
|
||||
harness = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
rustdoc-args = [
|
||||
"--generate-link-to-definition",
|
||||
"--generate-macro-expansion",
|
||||
"--extern-html-root-url=core=https://doc.rust-lang.org",
|
||||
]
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
# Żmij
|
||||
|
||||
[<img alt="github" src="https://img.shields.io/badge/github-dtolnay/zmij-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/dtolnay/zmij)
|
||||
[<img alt="crates.io" src="https://img.shields.io/crates/v/zmij.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/zmij)
|
||||
[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-zmij-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs" height="20">](https://docs.rs/zmij)
|
||||
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/dtolnay/zmij/ci.yml?branch=master&style=for-the-badge" height="20">](https://github.com/dtolnay/zmij/actions?query=branch%3Amaster)
|
||||
|
||||
Pure Rust implementation of Żmij, an algorithm to quickly convert floating point
|
||||
numbers to decimal strings.
|
||||
|
||||
This Rust implementation is a line-by-line port of Victor Zverovich's
|
||||
implementation in C++, [https://github.com/vitaut/zmij][upstream].
|
||||
|
||||
[upstream]: https://github.com/vitaut/zmij/tree/b32688a1849d1b8f092c1740c61a6b05ea4679ae
|
||||
|
||||
## Example
|
||||
|
||||
```rust
|
||||
fn main() {
|
||||
let mut buffer = zmij::Buffer::new();
|
||||
let printed = buffer.format(1.234);
|
||||
assert_eq!(printed, "1.234");
|
||||
}
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
||||
The [dtoa-benchmark] compares this library and other Rust floating point
|
||||
formatting implementations across a range of precisions. The vertical axis in
|
||||
this chart shows nanoseconds taken by a single execution of
|
||||
`zmij::Buffer::new().format_finite(value)` so a lower result indicates a faster
|
||||
library.
|
||||
|
||||
[dtoa-benchmark]: https://github.com/dtolnay/dtoa-benchmark
|
||||
|
||||

|
||||
|
||||
<br>
|
||||
|
||||
#### License
|
||||
|
||||
<a href="LICENSE-MIT">MIT license</a>.
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#![allow(clippy::unreadable_literal)]
|
||||
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use std::f64;
|
||||
use std::hint;
|
||||
use std::io::Write;
|
||||
|
||||
fn do_bench(c: &mut Criterion, group_name: &str, float: f64) {
|
||||
let mut group = c.benchmark_group(group_name);
|
||||
group.bench_function("zmij", |b| {
|
||||
let mut buf = zmij::Buffer::new();
|
||||
b.iter(move || {
|
||||
let float = hint::black_box(float);
|
||||
let formatted = buf.format_finite(float);
|
||||
hint::black_box(formatted);
|
||||
});
|
||||
});
|
||||
group.bench_function("ryu", |b| {
|
||||
let mut buf = ryu::Buffer::new();
|
||||
b.iter(move || {
|
||||
let float = hint::black_box(float);
|
||||
let formatted = buf.format_finite(float);
|
||||
hint::black_box(formatted);
|
||||
});
|
||||
});
|
||||
group.bench_function("std::fmt", |b| {
|
||||
let mut buf = Vec::with_capacity(20);
|
||||
b.iter(|| {
|
||||
buf.clear();
|
||||
let float = hint::black_box(float);
|
||||
write!(&mut buf, "{float}").unwrap();
|
||||
hint::black_box(buf.as_slice());
|
||||
});
|
||||
});
|
||||
group.finish();
|
||||
}
|
||||
|
||||
fn bench(c: &mut Criterion) {
|
||||
do_bench(c, "f64[0]", 0f64);
|
||||
do_bench(c, "f64[short]", 0.1234f64);
|
||||
do_bench(c, "f64[medium]", 0.123456789f64);
|
||||
do_bench(c, "f64[e]", f64::consts::E);
|
||||
do_bench(c, "f64[max]", f64::MAX);
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench);
|
||||
criterion_main!(benches);
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::process::{self, Command};
|
||||
use std::str;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
let rustc = rustc_minor_version().unwrap_or(u32::MAX);
|
||||
|
||||
if rustc >= 80 {
|
||||
println!("cargo:rustc-check-cfg=cfg(exhaustive)");
|
||||
println!("cargo:rustc-check-cfg=cfg(opt_level, values(\"s\"))");
|
||||
println!("cargo:rustc-check-cfg=cfg(zmij_no_select_unpredictable)");
|
||||
}
|
||||
|
||||
if rustc < 88 {
|
||||
// https://doc.rust-lang.org/std/hint/fn.select_unpredictable.html
|
||||
println!("cargo:rustc-cfg=zmij_no_select_unpredictable");
|
||||
}
|
||||
|
||||
if let Some(opt_level) = env::var_os("OPT_LEVEL") {
|
||||
if opt_level == "s" || opt_level == "z" {
|
||||
println!("cargo:rustc-cfg=opt_level=\"s\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn rustc_minor_version() -> Option<u32> {
|
||||
let rustc = cargo_env_var("RUSTC");
|
||||
let output = Command::new(rustc).arg("--version").output().ok()?;
|
||||
let version = str::from_utf8(&output.stdout).ok()?;
|
||||
let mut pieces = version.split('.');
|
||||
if pieces.next() != Some("rustc 1") {
|
||||
return None;
|
||||
}
|
||||
pieces.next()?.parse().ok()
|
||||
}
|
||||
|
||||
fn cargo_env_var(key: &str) -> OsString {
|
||||
env::var_os(key).unwrap_or_else(|| {
|
||||
eprintln!("Environment variable ${key} is not set during execution of build script");
|
||||
process::exit(1);
|
||||
})
|
||||
}
|
||||
+1857
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,65 @@
|
||||
use core::mem;
|
||||
|
||||
pub use core::arch::x86_64::*;
|
||||
|
||||
pub const fn _MM_SHUFFLE(z: u32, y: u32, x: u32, w: u32) -> i32 {
|
||||
((z << 6) | (y << 4) | (x << 2) | w) as i32
|
||||
}
|
||||
|
||||
pub const fn _mm_set_epi64x(e1: i64, e0: i64) -> __m128i {
|
||||
unsafe { mem::transmute([e0, e1]) }
|
||||
}
|
||||
|
||||
pub const fn _mm_set_epi32(e3: i32, e2: i32, e1: i32, e0: i32) -> __m128i {
|
||||
unsafe { mem::transmute([e0, e1, e2, e3]) }
|
||||
}
|
||||
|
||||
pub const fn _mm_set_epi16(
|
||||
e7: i16,
|
||||
e6: i16,
|
||||
e5: i16,
|
||||
e4: i16,
|
||||
e3: i16,
|
||||
e2: i16,
|
||||
e1: i16,
|
||||
e0: i16,
|
||||
) -> __m128i {
|
||||
unsafe { mem::transmute([e0, e1, e2, e3, e4, e5, e6, e7]) }
|
||||
}
|
||||
|
||||
pub const fn _mm_set_epi8(
|
||||
e15: i8,
|
||||
e14: i8,
|
||||
e13: i8,
|
||||
e12: i8,
|
||||
e11: i8,
|
||||
e10: i8,
|
||||
e9: i8,
|
||||
e8: i8,
|
||||
e7: i8,
|
||||
e6: i8,
|
||||
e5: i8,
|
||||
e4: i8,
|
||||
e3: i8,
|
||||
e2: i8,
|
||||
e1: i8,
|
||||
e0: i8,
|
||||
) -> __m128i {
|
||||
unsafe {
|
||||
mem::transmute([
|
||||
e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15,
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn _mm_set1_epi64x(a: i64) -> __m128i {
|
||||
_mm_set_epi64x(a, a)
|
||||
}
|
||||
|
||||
pub const fn _mm_set1_epi32(a: i32) -> __m128i {
|
||||
_mm_set_epi32(a, a, a, a)
|
||||
}
|
||||
|
||||
pub const fn _mm_set1_epi16(a: i16) -> __m128i {
|
||||
_mm_set_epi16(a, a, a, a, a, a, a, a)
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
use core::f64::consts::LOG2_10;
|
||||
use core::mem;
|
||||
use num_bigint::BigUint as Uint;
|
||||
|
||||
const _: () = {
|
||||
let static_data = mem::size_of_val(&crate::STATIC_DATA.pow10_significands)
|
||||
+ mem::size_of_val(&crate::STATIC_DATA.exp_shifts)
|
||||
+ mem::size_of_val(&crate::STATIC_DATA.exp_strings)
|
||||
+ mem::size_of_val(&crate::DIGITS2);
|
||||
if cfg!(opt_level = "s") {
|
||||
assert!(static_data == 200);
|
||||
} else {
|
||||
assert!(static_data == 17232); // 16.8K
|
||||
}
|
||||
};
|
||||
|
||||
#[cfg(target_endian = "little")]
|
||||
#[test]
|
||||
fn utilities() {
|
||||
let clz = u64::leading_zeros;
|
||||
assert_eq!(clz(1), 63);
|
||||
assert_eq!(clz(!0), 0);
|
||||
|
||||
assert_eq!(crate::count_trailing_nonzeros(0x00000000_00000000), 0);
|
||||
assert_eq!(crate::count_trailing_nonzeros(0x00000000_00000001), 1);
|
||||
assert_eq!(crate::count_trailing_nonzeros(0x00000000_00000009), 1);
|
||||
assert_eq!(crate::count_trailing_nonzeros(0x00090000_09000000), 7);
|
||||
assert_eq!(crate::count_trailing_nonzeros(0x01000000_00000000), 8);
|
||||
assert_eq!(crate::count_trailing_nonzeros(0x09000000_00000000), 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pow10() {
|
||||
const DEC_EXP_MIN: i32 = -292;
|
||||
|
||||
// Range of decimal exponents [K_min, K_max] from the paper.
|
||||
let dec_exp_min = -324_i32;
|
||||
let dec_exp_max = 292_i32;
|
||||
|
||||
let num_bits = 128_i32;
|
||||
|
||||
// Negate dec_pow_min and dec_pow_max because we need negative powers 10^-k.
|
||||
for (i, dec_exp) in (-dec_exp_max..=-dec_exp_min).enumerate() {
|
||||
// dec_exp is -k in the paper.
|
||||
let bin_exp = (f64::from(dec_exp) * LOG2_10).floor() as i32 - (num_bits - 1);
|
||||
let bin_pow = Uint::from(2_u8).pow(bin_exp.unsigned_abs());
|
||||
let dec_pow = Uint::from(10_u8).pow(dec_exp.unsigned_abs());
|
||||
let result = if dec_exp < 0 {
|
||||
bin_pow / dec_pow
|
||||
} else if bin_exp < 0 {
|
||||
dec_pow * bin_pow
|
||||
} else {
|
||||
dec_pow / bin_pow
|
||||
};
|
||||
let hi = u64::try_from(&result >> 64).unwrap();
|
||||
let lo = u64::try_from(result & (Uint::from(2_u8).pow(64) - Uint::from(1_u8))).unwrap();
|
||||
if !crate::Pow10SignificandTable::COMPRESS {
|
||||
assert_eq!(
|
||||
crate::STATIC_DATA
|
||||
.pow10_significands
|
||||
.get(DEC_EXP_MIN + i as i32),
|
||||
crate::uint128 { hi, lo },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
use core::fmt::Display;
|
||||
use core::ops::{Add, BitAnd, BitOr, BitOrAssign, BitXorAssign, Div, Mul, Shl, Shr, Sub};
|
||||
|
||||
pub trait Float: Copy {
|
||||
const MANTISSA_DIGITS: u32;
|
||||
const MIN_10_EXP: i32;
|
||||
const MAX_10_EXP: i32;
|
||||
const MAX_DIGITS10: u32;
|
||||
}
|
||||
|
||||
impl Float for f32 {
|
||||
const MANTISSA_DIGITS: u32 = Self::MANTISSA_DIGITS;
|
||||
const MIN_10_EXP: i32 = Self::MIN_10_EXP;
|
||||
const MAX_10_EXP: i32 = Self::MAX_10_EXP;
|
||||
const MAX_DIGITS10: u32 = 9;
|
||||
}
|
||||
|
||||
impl Float for f64 {
|
||||
const MANTISSA_DIGITS: u32 = Self::MANTISSA_DIGITS;
|
||||
const MIN_10_EXP: i32 = Self::MIN_10_EXP;
|
||||
const MAX_10_EXP: i32 = Self::MAX_10_EXP;
|
||||
const MAX_DIGITS10: u32 = 17;
|
||||
}
|
||||
|
||||
pub trait UInt:
|
||||
Copy
|
||||
+ From<u8>
|
||||
+ From<bool>
|
||||
+ Add<Output = Self>
|
||||
+ Sub<Output = Self>
|
||||
+ Mul<Output = Self>
|
||||
+ Div<Output = Self>
|
||||
+ BitAnd<Output = Self>
|
||||
+ BitOr<Output = Self>
|
||||
+ Shl<u8, Output = Self>
|
||||
+ Shl<i32, Output = Self>
|
||||
+ Shl<u32, Output = Self>
|
||||
+ Shr<i32, Output = Self>
|
||||
+ Shr<u32, Output = Self>
|
||||
+ BitOrAssign
|
||||
+ BitXorAssign
|
||||
+ PartialOrd
|
||||
+ Into<u64>
|
||||
+ Display
|
||||
{
|
||||
type Signed: Ord;
|
||||
}
|
||||
|
||||
impl UInt for u32 {
|
||||
type Signed = i32;
|
||||
}
|
||||
|
||||
impl UInt for u64 {
|
||||
type Signed = i64;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
|
||||
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(not(exhaustive), ignore = "requires cfg(exhaustive)")]
|
||||
fn test_exhaustive() {
|
||||
const BATCH_SIZE: u32 = 1_000_000;
|
||||
let counter = Arc::new(AtomicU32::new(0));
|
||||
let finished = Arc::new(AtomicU32::new(0));
|
||||
|
||||
let mut workers = Vec::new();
|
||||
for _ in 0..num_cpus::get() {
|
||||
let counter = counter.clone();
|
||||
let finished = finished.clone();
|
||||
workers.push(thread::spawn(move || loop {
|
||||
let batch = counter.fetch_add(1, Ordering::Relaxed);
|
||||
if batch > u32::MAX / BATCH_SIZE {
|
||||
return;
|
||||
}
|
||||
|
||||
let min = batch * BATCH_SIZE;
|
||||
let max = if batch == u32::MAX / BATCH_SIZE {
|
||||
u32::MAX
|
||||
} else {
|
||||
min + BATCH_SIZE - 1
|
||||
};
|
||||
|
||||
let mut zmij_buffer = zmij::Buffer::new();
|
||||
let mut ryu_buffer = ryu::Buffer::new();
|
||||
for u in min..=max {
|
||||
let f = f32::from_bits(u);
|
||||
if !f.is_finite() {
|
||||
continue;
|
||||
}
|
||||
let zmij = zmij_buffer.format_finite(f);
|
||||
assert_eq!(Ok(f), zmij.parse(), "{zmij:?}");
|
||||
let ryu = ryu_buffer.format_finite(f);
|
||||
let matches = if ryu.contains('e') && !ryu.contains("e-") {
|
||||
ryu.split_once('e') == zmij.split_once("e+")
|
||||
} else {
|
||||
ryu == zmij
|
||||
};
|
||||
assert!(matches, "{ryu} != {zmij}");
|
||||
}
|
||||
|
||||
let increment = max - min + 1;
|
||||
let update = finished.fetch_add(increment, Ordering::Relaxed);
|
||||
println!("{}", u64::from(update) + u64::from(increment));
|
||||
}));
|
||||
}
|
||||
|
||||
for w in workers {
|
||||
w.join().unwrap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
use rand::rngs::{SmallRng, SysRng};
|
||||
use rand::{Rng as _, SeedableRng as _};
|
||||
|
||||
const N: usize = if cfg!(miri) {
|
||||
500
|
||||
} else if let b"0" = opt_level::OPT_LEVEL.as_bytes() {
|
||||
1_000_000
|
||||
} else {
|
||||
100_000_000
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn ryu_comparison() {
|
||||
let mut ryu_buffer = ryu::Buffer::new();
|
||||
let mut zmij_buffer = zmij::Buffer::new();
|
||||
let mut rng = SmallRng::try_from_rng(&mut SysRng).unwrap();
|
||||
let mut fail = 0;
|
||||
|
||||
for _ in 0..N {
|
||||
let bits = rng.next_u64();
|
||||
let float = f64::from_bits(bits);
|
||||
let ryu = ryu_buffer.format(float);
|
||||
let zmij = zmij_buffer.format(float);
|
||||
let matches = if ryu.contains('e') && !ryu.contains("e-") {
|
||||
ryu.split_once('e') == zmij.split_once("e+")
|
||||
} else {
|
||||
ryu == zmij
|
||||
};
|
||||
if !matches {
|
||||
eprintln!("RYU={ryu} ZMIJ={zmij}");
|
||||
fail += 1;
|
||||
}
|
||||
}
|
||||
|
||||
assert!(fail == 0, "{fail} mismatches");
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
#![allow(clippy::float_cmp, clippy::unreadable_literal)]
|
||||
|
||||
fn dtoa(value: f64) -> String {
|
||||
zmij::Buffer::new().format(value).to_owned()
|
||||
}
|
||||
|
||||
fn ftoa(value: f32) -> String {
|
||||
zmij::Buffer::new().format(value).to_owned()
|
||||
}
|
||||
|
||||
mod dtoa_test {
|
||||
use super::dtoa;
|
||||
|
||||
#[test]
|
||||
fn normal() {
|
||||
assert_eq!(dtoa(6.62607015e-34), "6.62607015e-34");
|
||||
|
||||
// Exact half-ulp tie when rounding to nearest integer.
|
||||
assert_eq!(dtoa(5.444310685350916e+14), "544431068535091.6");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn subnormal() {
|
||||
assert_eq!(dtoa(0.0f64.next_up()), "5e-324");
|
||||
assert_eq!(dtoa(1e-323), "1e-323");
|
||||
assert_eq!(dtoa(1.2e-322), "1.2e-322");
|
||||
assert_eq!(dtoa(1.24e-322), "1.24e-322");
|
||||
assert_eq!(dtoa(1.234e-320), "1.234e-320");
|
||||
assert_eq!(dtoa(2.2250738585072004e-308), "2.2250738585072004e-308");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_irregular() {
|
||||
for exp in 1..0x3ff {
|
||||
let bits = exp << 52;
|
||||
let value = f64::from_bits(bits);
|
||||
|
||||
assert_eq!(dtoa(value), ryu::Buffer::new().format(value));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_exponents() {
|
||||
for exp in 0..=0x3ff {
|
||||
let bits = (exp << 52) | 1;
|
||||
let value = f64::from_bits(bits);
|
||||
|
||||
assert_eq!(dtoa(value), ryu::Buffer::new().format(value));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn small_int() {
|
||||
assert_eq!(dtoa(1.0), "1.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zero() {
|
||||
assert_eq!(dtoa(0.0), "0.0");
|
||||
assert_eq!(dtoa(-0.0), "-0.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inf() {
|
||||
assert_eq!(dtoa(f64::INFINITY), "inf");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nan() {
|
||||
assert_eq!(dtoa(f64::NAN.copysign(-1.0)), "NaN");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shorter() {
|
||||
// A possibly shorter underestimate is picked (u' in Schubfach).
|
||||
assert_eq!(dtoa(-4.932096661796888e-226), "-4.932096661796888e-226");
|
||||
|
||||
// A possibly shorter overestimate is picked (w' in Schubfach).
|
||||
assert_eq!(dtoa(3.439070283483335e+35), "3.439070283483335e+35");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_candidate() {
|
||||
// Only an underestimate is in the rounding region (u in Schubfach).
|
||||
assert_eq!(dtoa(6.606854224493745e-17), "6.606854224493745e-17");
|
||||
|
||||
// Only an overestimate is in the rounding region (w in Schubfach).
|
||||
assert_eq!(dtoa(6.079537928711555e+61), "6.079537928711555e+61");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn boundary_cases() {
|
||||
assert_eq!(dtoa(1.3588129002659584e-245), "1.3588129002659584e-245");
|
||||
assert_eq!(dtoa(2.9802322387695312e-08), "2.9802322387695312e-8");
|
||||
assert_eq!(dtoa(5.960464477539063e-08), "5.960464477539063e-8");
|
||||
assert_eq!(dtoa(1.3076622631878654e+65), "1.3076622631878654e+65");
|
||||
assert_eq!(dtoa(9.03725590277404e+159), "9.03725590277404e+159");
|
||||
assert_eq!(dtoa(9.03725590277404e+160), "9.03725590277404e+160");
|
||||
assert_eq!(dtoa(9.03725590277404e+161), "9.03725590277404e+161");
|
||||
assert_eq!(dtoa(9.03725590277404e+162), "9.03725590277404e+162");
|
||||
assert_eq!(dtoa(5.960464477539062e-07), "5.960464477539062e-7");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fixed_with_zeros() {
|
||||
assert_eq!(dtoa(43210.0), "43210.0");
|
||||
assert_eq!(dtoa(43210.1), "43210.1");
|
||||
assert_eq!(dtoa(10000.0), "10000.0");
|
||||
assert_eq!(dtoa(-5942736479622170.0), "-5942736479622170.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_buffer() {
|
||||
assert_eq!(dtoa(6.62607015e-34), "6.62607015e-34");
|
||||
}
|
||||
}
|
||||
|
||||
mod ftoa_test {
|
||||
use super::ftoa;
|
||||
|
||||
#[test]
|
||||
fn fixed_with_zeros() {
|
||||
assert_eq!(ftoa(43210.0), "43210.0");
|
||||
assert_eq!(ftoa(43210.1), "43210.1");
|
||||
assert_eq!(ftoa(10000.0), "10000.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normal() {
|
||||
assert_eq!(ftoa(6.62607e-34), "6.62607e-34");
|
||||
assert_eq!(ftoa(1.342178e+08), "134217800.0");
|
||||
assert_eq!(ftoa(1.3421781e+08), "134217810.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn subnormal() {
|
||||
assert_eq!(ftoa(0.0f32.next_up()), "1e-45");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_buffer() {
|
||||
assert_eq!(ftoa(6.62607e-34), "6.62607e-34");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user