Registry / testing / assert-float-eq

assert-float-eq

JSON →
library1.2.0rscratesunverified

Assertions for floating-point equality.

# Cargo.toml [dependencies] assert_float_eq = "1.2.0"
INSTALL
IMPORT
SIG · ASSERT-FLOAT-EQ
A
assert-float-eq
testingrustv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

assert_float_eq
use assert_float_eq::assert_float_eq;

Asserts that two floating-point numbers are approximately equal within a tolerance.

use assert_float_eq::assert_float_eq; fn main() { let a = 1.0f64; let b = 1.0000000001; assert_float_eq!(a, b, r2nd <= 1e-6); println!("Floats are approximately equal"); }
Debug
Known issues
gotchaRequires explicit tolerance specification; default may be too strict.
fix
Always specify a tolerance like `r2nd <= 1e-6` or `abs <= 1e-6`.
affects: >=1.0.0
Upgrade
Version history
1.2.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
assert-float-eq — cargo add assert-float-eq · libregistry