about summary refs log tree commit diff
path: root/src/rt/rust_kernel.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-06 09:12:37 -0700
committerbors <bors@rust-lang.org>2013-05-06 09:12:37 -0700
commitb6dea9d41df25f1c6a6a0444395a9b29c8081cbe (patch)
tree885dcc297588b43cf7a3fb910274228a58ecde58 /src/rt/rust_kernel.cpp
parent6e6a4be19d8e6a2cedc66be6cc602db8a1e71acd (diff)
parent0e2242f6d62d6d49bf8a2d1860a41273c1fdfa0d (diff)
downloadrust-b6dea9d41df25f1c6a6a0444395a9b29c8081cbe.tar.gz
rust-b6dea9d41df25f1c6a6a0444395a9b29c8081cbe.zip
auto merge of #6263 : bjz/rust/approx-eq, r=erickt
Moving the trait into `core` allows it to be added to the `num::Float` trait.

I have also added and `assert_approx_eq!` macro. This is useful fo making approximate assertions on types that implement the `ApproxEq` trait.

Examples:

~~~rust
// using the default epsilon value
assert_approx_eq!(1.0000001f, 1.0f);

// using a custom epsilon value
assert_approx_eq!(1.000001f, 1.0f, 1.0e-5);

// fails with: "left: 1.00001 does not approximately equal right: 1"
assert_approx_eq!(1.00001f, 1.0f);
~~~
Diffstat (limited to 'src/rt/rust_kernel.cpp')
0 files changed, 0 insertions, 0 deletions