mixed_num/
traits.rs

1mod math_traits;
2pub use math_traits::*;
3
4mod complex_traits;
5pub use complex_traits::*;
6
7pub trait MixedCeil
8{
9    /// Round Self up to the closest nteger.
10    fn mixed_ceil(&self) -> Self;
11}
12
13pub trait MixedFloor
14{
15    /// Round Self up to the closest nteger.
16    fn mixed_floor(&self) -> Self;
17}
18
19pub trait MixedNumConversion<T> {
20    /// Generic type cast from numeric type T.
21    fn mixed_from_num( number:T ) -> Self;
22    /// Generic type cast to  numeric type T.
23    fn mixed_to_num( &self )      -> T;
24}
25
26pub trait MixedZero
27{
28    /// Return the zero value of type Self.
29    fn mixed_zero() -> Self;
30}
31
32pub trait MixedOne
33{
34    /// Return the zero value of type Self.
35    fn mixed_one() -> Self;
36}
37
38pub trait MixedPi
39{
40    /// The mixed_pi constant. 3.141...
41    fn mixed_pi() -> Self;
42    fn mixed_tau() -> Self;
43}
44
45pub trait MixedConsts
46    where Self: MixedPi + MixedZero + MixedOne
47{
48}
49
50pub trait MixedNum
51    where Self:   core::cmp::PartialOrd
52                + core::marker::Sized
53                + Copy
54                + Clone
55{
56}
57
58pub trait MixedReal
59    where Self:   MixedNum
60                + MixedNumConversion<u32> + MixedNumConversion<u64>
61                + MixedNumConversion<i32> + MixedNumConversion<i64>
62                + MixedNumConversion<f32> + MixedNumConversion<f64>
63{
64    /// Maximum value of the type.
65    fn mixed_max_value() -> Self;
66    /// Minimum value of the type.
67    fn mixed_min_value() -> Self;
68    /// Get the sign of the argument with a unit value.
69    /// Zero is of positive sign.
70    fn mixed_sign( &self ) -> Self;
71    /// Returns a bool if self is positive.
72    fn mixed_is_positive( &self ) -> bool;
73    /// Returns a bool if self is negative.
74    fn mixed_is_negative( &self ) -> bool;
75}
76
77pub trait MixedComplex
78{
79
80}
81
82pub trait MixedNumSigned
83    where Self: core::ops::Neg<Output = Self>
84{
85}