Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion approx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ordered_float = ["dep:ordered-float"]
num_complex = ["dep:num-complex"]

[dependencies]
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", optional = true }
ordered-float = { version = "5", optional = true }
approx-derive = { path = "../approx-derive/", version = "0.6.0-rc2", optional = true }
Expand Down
9 changes: 3 additions & 6 deletions approx/src/abs_diff_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use indexmap::IndexMap;
#[cfg(feature = "num_complex")]
use num_complex::Complex;
#[cfg(feature = "ordered_float")]
use num_traits::Float;
#[cfg(feature = "ordered_float")]
use ordered_float::{NotNan, OrderedFloat};

/// Equality that is defined using the absolute difference of two numbers.
Expand Down Expand Up @@ -99,7 +97,6 @@ macro_rules! impl_signed_abs_diff_eq {
#[inline]
#[allow(unused_imports)]
fn abs_diff_eq(&self, other: &$T, epsilon: $T) -> bool {
use num_traits::float::FloatCore;
$T::abs(self - other) <= epsilon
}
}
Expand Down Expand Up @@ -377,7 +374,7 @@ impl<T: AbsDiffEq + Copy> AbsDiffEq for NotNan<T> {

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: AbsDiffEq + Float + ordered_float::FloatCore> AbsDiffEq<T> for NotNan<T> {
impl<T: AbsDiffEq + ordered_float::FloatCore> AbsDiffEq<T> for NotNan<T> {
type Epsilon = T::Epsilon;

#[inline]
Expand All @@ -393,7 +390,7 @@ impl<T: AbsDiffEq + Float + ordered_float::FloatCore> AbsDiffEq<T> for NotNan<T>

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: AbsDiffEq + Float + ordered_float::FloatCore> AbsDiffEq for OrderedFloat<T> {
impl<T: AbsDiffEq + ordered_float::FloatCore> AbsDiffEq for OrderedFloat<T> {
type Epsilon = T::Epsilon;

#[inline]
Expand All @@ -409,7 +406,7 @@ impl<T: AbsDiffEq + Float + ordered_float::FloatCore> AbsDiffEq for OrderedFloat

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: AbsDiffEq + Float + ordered_float::FloatCore> AbsDiffEq<T> for OrderedFloat<T> {
impl<T: AbsDiffEq + ordered_float::FloatCore> AbsDiffEq<T> for OrderedFloat<T> {
type Epsilon = T::Epsilon;

#[inline]
Expand Down
1 change: 0 additions & 1 deletion approx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
#[cfg(feature = "num_complex")]
#[cfg_attr(docsrs, doc(cfg(feature = "num_complex")))]
extern crate num_complex;
extern crate num_traits;
#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
extern crate ordered_float;
Expand Down
9 changes: 3 additions & 6 deletions approx/src/relative_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use indexmap::IndexMap;
#[cfg(feature = "num_complex")]
use num_complex::Complex;

#[cfg(feature = "ordered_float")]
use num_traits::Float;
#[cfg(feature = "ordered_float")]
use ordered_float::{NotNan, OrderedFloat};

Expand Down Expand Up @@ -86,7 +84,6 @@ macro_rules! impl_relative_eq {
#[inline]
#[allow(unused_imports)]
fn relative_eq(&self, other: &$T, epsilon: $T, max_relative: $T) -> bool {
use num_traits::float::FloatCore;
// Handle same infinities
if self == other {
return true;
Expand Down Expand Up @@ -465,7 +462,7 @@ impl<T: RelativeEq + Copy> RelativeEq for NotNan<T> {

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: RelativeEq + Float + ordered_float::FloatCore> RelativeEq<T> for NotNan<T> {
impl<T: RelativeEq + ordered_float::FloatCore> RelativeEq<T> for NotNan<T> {
#[inline]
fn default_relative_epsilon() -> Self::Epsilon {
T::default_relative_epsilon()
Expand All @@ -484,7 +481,7 @@ impl<T: RelativeEq + Float + ordered_float::FloatCore> RelativeEq<T> for NotNan<

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: RelativeEq + Float + ordered_float::FloatCore> RelativeEq for OrderedFloat<T> {
impl<T: RelativeEq + ordered_float::FloatCore> RelativeEq for OrderedFloat<T> {
#[inline]
fn default_relative_epsilon() -> Self::Epsilon {
T::default_relative_epsilon()
Expand Down Expand Up @@ -513,7 +510,7 @@ impl<T: RelativeEq + Float + ordered_float::FloatCore> RelativeEq for OrderedFlo

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: RelativeEq + Float + ordered_float::FloatCore> RelativeEq<T> for OrderedFloat<T> {
impl<T: RelativeEq + ordered_float::FloatCore> RelativeEq<T> for OrderedFloat<T> {
#[inline]
fn default_relative_epsilon() -> Self::Epsilon {
T::default_relative_epsilon()
Expand Down
9 changes: 3 additions & 6 deletions approx/src/ulps_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ use indexmap::IndexMap;
#[cfg(feature = "num_complex")]
use num_complex::Complex;
#[cfg(feature = "ordered_float")]
use num_traits::Float;
use num_traits::Signed;
#[cfg(feature = "ordered_float")]
use ordered_float::{NotNan, OrderedFloat};

use crate::AbsDiffEq;
Expand Down Expand Up @@ -324,7 +321,7 @@ impl<T: UlpsEq + Copy> UlpsEq for NotNan<T> {

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: UlpsEq + Float + ordered_float::FloatCore> UlpsEq<T> for NotNan<T> {
impl<T: UlpsEq + ordered_float::FloatCore> UlpsEq<T> for NotNan<T> {
#[inline]
fn default_max_ulps() -> u32 {
T::default_max_ulps()
Expand All @@ -338,7 +335,7 @@ impl<T: UlpsEq + Float + ordered_float::FloatCore> UlpsEq<T> for NotNan<T> {

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: UlpsEq + Float + ordered_float::FloatCore> UlpsEq for OrderedFloat<T> {
impl<T: UlpsEq + ordered_float::FloatCore> UlpsEq for OrderedFloat<T> {
#[inline]
fn default_max_ulps() -> u32 {
T::default_max_ulps()
Expand All @@ -352,7 +349,7 @@ impl<T: UlpsEq + Float + ordered_float::FloatCore> UlpsEq for OrderedFloat<T> {

#[cfg(feature = "ordered_float")]
#[cfg_attr(docsrs, doc(cfg(feature = "ordered_float")))]
impl<T: UlpsEq + Float + ordered_float::FloatCore> UlpsEq<T> for OrderedFloat<T> {
impl<T: UlpsEq + ordered_float::FloatCore> UlpsEq<T> for OrderedFloat<T> {
#[inline]
fn default_max_ulps() -> u32 {
T::default_max_ulps()
Expand Down
Loading