src/types.rs

changeset 90
b3c35d16affe
parent 62
d8305c9b6fdf
child 86
d5b0e496b72f
equal deleted inserted replaced
25:d14c877e14b7 90:b3c35d16affe
10 */ 10 */
11 11
12 //use trait_set::trait_set; 12 //use trait_set::trait_set;
13 pub use num_traits::Float as NumTraitsFloat; // needed to re-export functions. 13 pub use num_traits::Float as NumTraitsFloat; // needed to re-export functions.
14 pub use num_traits::cast::AsPrimitive; 14 pub use num_traits::cast::AsPrimitive;
15
16 pub use simba::scalar::{
17 ClosedAdd, ClosedAddAssign,
18 ClosedSub, ClosedSubAssign,
19 ClosedMul, ClosedMulAssign,
20 ClosedDiv, ClosedDivAssign,
21 ClosedNeg
22 };
15 23
16 /// Typical integer type 24 /// Typical integer type
17 #[allow(non_camel_case_types)] 25 #[allow(non_camel_case_types)]
18 pub type int = i64; 26 pub type int = i64;
19 27
55 + std::fmt::Debug + std::fmt::Display + serde::Serialize 63 + std::fmt::Debug + std::fmt::Display + serde::Serialize
56 + CastFrom<u8> + CastFrom<u16> + CastFrom<u32> + CastFrom<u64> 64 + CastFrom<u8> + CastFrom<u16> + CastFrom<u32> + CastFrom<u64>
57 + CastFrom<u128> + CastFrom<usize> 65 + CastFrom<u128> + CastFrom<usize>
58 + CastFrom<i8> + CastFrom<i16> + CastFrom<i32> + CastFrom<i64> 66 + CastFrom<i8> + CastFrom<i16> + CastFrom<i32> + CastFrom<i64>
59 + CastFrom<i128> + CastFrom<isize> 67 + CastFrom<i128> + CastFrom<isize>
60 + CastFrom<f32> + CastFrom<f64> { 68 + CastFrom<f32> + CastFrom<f64>
69 + crate::instance::Space {
61 70
62 const ZERO : Self; 71 const ZERO : Self;
63 const ONE : Self; 72 const ONE : Self;
64 const TWO : Self; 73 const TWO : Self;
65 /// Generic version of `Self::MAX` 74 /// Generic version of `Self::MAX`
82 const E : Self; 91 const E : Self;
83 const EPSILON : Self; 92 const EPSILON : Self;
84 const SQRT_2 : Self; 93 const SQRT_2 : Self;
85 const INFINITY : Self; 94 const INFINITY : Self;
86 const NEG_INFINITY : Self; 95 const NEG_INFINITY : Self;
96 const NAN : Self;
87 const FRAC_2_SQRT_PI : Self; 97 const FRAC_2_SQRT_PI : Self;
88 } 98 }
89 99
90 /// Trait for integers 100 /// Trait for integers
91 pub trait Integer : Num + num::Integer {} 101 pub trait Integer : Num + num::Integer {}
131 const E : Self = std::f64::consts::E; 141 const E : Self = std::f64::consts::E;
132 const EPSILON : Self = std::f64::EPSILON; 142 const EPSILON : Self = std::f64::EPSILON;
133 const SQRT_2 : Self = std::f64::consts::SQRT_2; 143 const SQRT_2 : Self = std::f64::consts::SQRT_2;
134 const INFINITY : Self = std::f64::INFINITY; 144 const INFINITY : Self = std::f64::INFINITY;
135 const NEG_INFINITY : Self = std::f64::NEG_INFINITY; 145 const NEG_INFINITY : Self = std::f64::NEG_INFINITY;
146 const NAN : Self = std::f64::NAN;
136 const FRAC_2_SQRT_PI : Self = std::f64::consts::FRAC_2_SQRT_PI; 147 const FRAC_2_SQRT_PI : Self = std::f64::consts::FRAC_2_SQRT_PI;
137 } 148 }
138 149
139 impl Float for f32 { 150 impl Float for f32 {
140 /* 151 /*
148 const E : Self = std::f32::consts::E; 159 const E : Self = std::f32::consts::E;
149 const EPSILON : Self = std::f32::EPSILON; 160 const EPSILON : Self = std::f32::EPSILON;
150 const SQRT_2 : Self = std::f32::consts::SQRT_2; 161 const SQRT_2 : Self = std::f32::consts::SQRT_2;
151 const INFINITY : Self = std::f32::INFINITY; 162 const INFINITY : Self = std::f32::INFINITY;
152 const NEG_INFINITY : Self = std::f32::NEG_INFINITY; 163 const NEG_INFINITY : Self = std::f32::NEG_INFINITY;
164 const NAN : Self = std::f32::NAN;
153 const FRAC_2_SQRT_PI : Self = std::f32::consts::FRAC_2_SQRT_PI; 165 const FRAC_2_SQRT_PI : Self = std::f32::consts::FRAC_2_SQRT_PI;
154 } 166 }
155 167
156 /* 168 /*
157 trait_set! { 169 trait_set! {

mercurial