Debian Codegraph @

src/sign.rs

raw symbols SCIP
1 //! Trait definitions for sign related operations.
2
3 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{
4 cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#,
5 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#, MulAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/MulAssign#, Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#},
6 };
7
8 /// Absolute value.
9 ///
10 /// # Examples
11 /// ```
12 /// use dashu_base::Abs;
13 /// assert_eq!((-5).abs(), 5);
14 /// ```
15 pub trait Absrust-analyzer cargo dashu-base 0.4.1 sign/Abs# {
16 type Outputrust-analyzer cargo dashu-base 0.4.1 sign/Abs#Output#;
17
18 fn absrust-analyzer cargo dashu-base 0.4.1 sign/Abs#abs().(self) -> Self::Outputrust-analyzer cargo dashu-base 0.4.1 sign/Abs#Output#;
19 }
20
21 /// Unsigned absolute value.
22 ///
23 /// # Examples
24 /// ```
25 /// # use dashu_base::UnsignedAbs;
26 /// assert_eq!((-5i8).unsigned_abs(), 5u8);
27 /// ```
28 pub trait UnsignedAbsrust-analyzer cargo dashu-base 0.4.1 sign/UnsignedAbs# {
29 type Outputrust-analyzer cargo dashu-base 0.4.1 sign/UnsignedAbs#Output#;
30
31 fn unsigned_absrust-analyzer cargo dashu-base 0.4.1 sign/UnsignedAbs#unsigned_abs().(self) -> Self::Outputrust-analyzer cargo dashu-base 0.4.1 sign/UnsignedAbs#Output#;
32 }
33
34 /// Check whether the magnitude of this number is equal the magnitude of the other number
35 ///
36 /// # Examples
37 ///
38 /// ```
39 /// # use dashu_base::AbsEq;
40 /// assert!(5.abs_eq(&-5));
41 /// assert!(12.3.abs_eq(&-12.3));
42 /// ```
43 #[deprecated(since = "0.5.0", note = "AbsEq will be moved in AbsOrd in v0.5")] // TODO(v0.5): deprecate
44 pub trait AbsEqrust-analyzer cargo dashu-base 0.4.1 sign/AbsEq#<Rhs = Self> {
45 fn abs_eqrust-analyzer cargo dashu-base 0.4.1 sign/AbsEq#abs_eq().(&self, rhs: &Rhs) -> bool;
46 }
47
48 /// Compare the magnitude of this number to the magnitude of the other number
49 ///
50 /// Note that this function will panic if either of the numbers is NaN.
51 ///
52 /// # Examples
53 ///
54 /// ```
55 /// # use dashu_base::AbsOrd;
56 /// assert!(5.abs_cmp(&-6).is_le());
57 /// assert!(12.3.abs_cmp(&-12.3).is_eq());
58 /// ```
59 pub trait AbsOrdrust-analyzer cargo dashu-base 0.4.1 sign/AbsOrd#<Rhs = Self> {
60 fn abs_cmprust-analyzer cargo dashu-base 0.4.1 sign/AbsOrd#abs_cmp().(&self, rhs: &Rhs) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#;
61 }
62
63 /// This trait marks the number is signed.
64 ///
65 /// Notice that the negative zeros (of [f32] and [f64]) are still considered
66 /// to have a positive sign.
67 ///
68 /// # Examples
69 ///
70 /// ```
71 /// # use dashu_base::{Signed, Sign};
72 /// assert_eq!((-2).sign(), Sign::Negative);
73 /// assert_eq!((-2.4).sign(), Sign::Negative);
74 /// assert_eq!((0.).sign(), Sign::Positive);
75 ///
76 /// assert!(2.is_positive());
77 /// assert!((-2.4).is_negative());
78 /// assert!((0.).is_positive());
79 /// ```
80 pub trait Signedrust-analyzer cargo dashu-base 0.4.1 sign/Signed# {
81 fn signrust-analyzer cargo dashu-base 0.4.1 sign/Signed#sign().(&self) -> Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#;
82
83 #[inline]
84 fn is_positiverust-analyzer cargo dashu-base 0.4.1 sign/Signed#is_positive().(&self) -> bool {
85 self.signrust-analyzer cargo dashu-base 0.4.1 sign/Signed#sign().() rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialEq<Self>`]eq().==rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialEq<Self>`]eq(). rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialEq<Self>`]eq().Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#
86 }
87 #[inline]
88 fn is_negativerust-analyzer cargo dashu-base 0.4.1 sign/Signed#is_negative().(&self) -> bool {
89 self.signrust-analyzer cargo dashu-base 0.4.1 sign/Signed#sign().() rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialEq<Self>`]eq().==rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialEq<Self>`]eq(). rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialEq<Self>`]eq().Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#
90 }
91 }
92
93 macro_rules! impl_abs_ops_primrust-analyzer cargo dashu-base 0.4.1 sign/impl_abs_ops_prim! {
94 ($($signed:ty;)*) => {$( // this branch is only for float
95 impl Abs for $signed {
96 type Output = $signed;
97 #[inline]
98 fn abs(self) -> Self::Output {
99 if self.is_nan() || self >= 0. {
100 self
101 } else {
102 -self
103 }
104 }
105 }
106 )*};
107 ($($signed:ty => $unsigned:ty;)*) => {$(
108 impl Abs for $signed {
109 type Output = $signed;
110 #[inline]
111 fn abs(self) -> Self::Output {
112 <$signed>::abs(self)
113 }
114 }
115
116 impl UnsignedAbs for $signed {
117 type Output = $unsigned;
118 #[inline]
119 fn unsigned_abs(self) -> Self::Output {
120 <$signed>::unsigned_abs(self)
121 }
122 }
123 )*}
124 }
125 impl_abs_ops_primrust-analyzer cargo dashu-base 0.4.1 sign/impl_abs_ops_prim!!(i8 => u8; i16 => u16; i32 => u32; i64 => u64; i128 => u128; isize => usize;);
126 impl_abs_ops_primrust-analyzer cargo dashu-base 0.4.1 sign/impl_abs_ops_prim!!(f32; f64;);
127
128 /// An enum representing the sign of a number
129 ///
130 /// A sign can be converted to or from a boolean value, assuming `true` is [Negative].
131 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
132 pub enum Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
133 Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#,
134 Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#,
135 }
136
137 use Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::*;
138
139 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<bool> for Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
140 /// Convert boolean value to [Sign], returns [Negative] for `true`
141 #[inline]
142 fn fromrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`From<bool>`]from().(v: bool) -> Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`From<bool>`] {
143 match v {
144 true => Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`From<bool>`]::Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#,
145 false => Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`From<bool>`]::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#,
146 }
147 }
148 }
149
150 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#> for bool {
151 /// Convert [Sign] to boolean value, returns `true` for [Negative]
152 #[inline]
153 fn fromrust-analyzer cargo dashu-base 0.4.1 sign/impl#[bool][`From<Sign>`]from().(v: Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#) -> Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[bool][`From<Sign>`] {
154 match v {
155 Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative# => true,
156 Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive# => false,
157 }
158 }
159 }
160
161 impl Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg# for Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
162 type Outputrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][Neg]Output# = Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#;
163
164 #[inline]
165 fn negrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][Neg]neg().(self) -> Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
166 match self {
167 Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive# => Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#,
168 Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative# => Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#,
169 }
170 }
171 }
172
173 impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#> for Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
174 type Outputrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Self>`]Output# = Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#;
175
176 #[inline]
177 fn mulrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Self>`]mul().(self, rhs: Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#) -> Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
178 match (self, rhs) {
179 (Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#, Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#) => Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#,
180 (Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#, Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#) => Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#,
181 (Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#, Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#) => Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#,
182 (Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#, Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#) => Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#,
183 }
184 }
185 }
186
187 impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> for Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
188 type Outputrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Ordering>`]Output# = Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#;
189 #[inline]
190 fn mulrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Ordering>`]mul().(self, rhs: Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#) -> Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Ordering>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# {
191 match self {
192 Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive# => rhs,
193 Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative# => rhs.reverserust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impl#[Ordering]reverse().(),
194 }
195 }
196 }
197
198 impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#> for Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# {
199 type Outputrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Ordering][`Mul<Sign>`]Output# = Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#;
200 #[inline]
201 fn mulrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Ordering][`Mul<Sign>`]mul().(self, rhs: Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#) -> Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Ordering][`Mul<Sign>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# {
202 match rhs {
203 Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive# => self,
204 Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative# => self.reverserust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impl#[Ordering]reverse().(),
205 }
206 }
207 }
208
209 impl MulAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/MulAssign#<Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#> for Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
210 #[inline]
211 fn mul_assignrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`MulAssign<Self>`]mul_assign().(&mut self, rhs: Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#) {
212 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Self>`]mul().*rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Self>`]mul(). rust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`Mul<Self>`]mul().rhs;
213 }
214 }
215
216 impl PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
217 #[inline]
218 fn partial_cmprust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialOrd<Self>`]partial_cmp().(&self, other: &Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][`PartialOrd<Self>`]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> {
219 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.cmprust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][Ord]cmp().(other))
220 }
221 }
222
223 impl Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# for Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign# {
224 #[inline]
225 fn cmprust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][Ord]cmp().(&self, other: &Selfrust-analyzer cargo dashu-base 0.4.1 sign/impl#[Sign][Ord]) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# {
226 match (self, other) {
227 (Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#, Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#) => Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Greaterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Greater#,
228 (Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#, Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#) => Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Lessrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Less#,
229 _ => Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Equalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Equal#,
230 }
231 }
232 }
233
234 macro_rules! impl_sign_ops_for_primitivesrust-analyzer cargo dashu-base 0.4.1 sign/impl_sign_ops_for_primitives! {
235 ($($t:ty)*) => {$(
236 impl Mul<$t> for Sign {
237 type Output = $t;
238
239 #[inline]
240 fn mul(self, rhs: $t) -> Self::Output {
241 match self {
242 Positive => rhs,
243 Negative => -rhs
244 }
245 }
246 }
247
248 impl Mul<Sign> for $t {
249 type Output = $t;
250
251 #[inline]
252 fn mul(self, rhs: Sign) -> Self::Output {
253 match rhs {
254 Positive => self,
255 Negative => -self
256 }
257 }
258 }
259 )*};
260 }
261 impl_sign_ops_for_primitivesrust-analyzer cargo dashu-base 0.4.1 sign/impl_sign_ops_for_primitives!!(i8 i16 i32 i64 i128 isize f32 f64);
262
263 macro_rules! impl_signed_for_intrust-analyzer cargo dashu-base 0.4.1 sign/impl_signed_for_int! {
264 ($($t:ty)*) => {$(
265 impl Signed for $t {
266 #[inline]
267 fn sign(&self) -> Sign {
268 Sign::from(*self < 0)
269 }
270 }
271
272 #[allow(deprecated)]
273 impl AbsEq for $t {
274 #[inline]
275 fn abs_eq(&self, rhs: &Self) -> bool {
276 self.abs() == rhs.abs()
277 }
278 }
279
280 impl AbsOrd for $t {
281 #[inline]
282 fn abs_cmp(&self, rhs: &Self) -> Ordering {
283 self.abs().cmp(&rhs.abs())
284 }
285 }
286 )*};
287 }
288 impl_signed_for_intrust-analyzer cargo dashu-base 0.4.1 sign/impl_signed_for_int!!(i8 i16 i32 i64 i128 isize);
289
290 macro_rules! impl_signed_for_floatrust-analyzer cargo dashu-base 0.4.1 sign/impl_signed_for_float! {
291 ($t:ty, $shift:literal) => {
292 impl Signed for $t {
293 #[inline]
294 fn sign(&self) -> Sign {
295 if self.is_nan() {
296 panic!("nan doesn't have a sign")
297 } else if *self == -0. {
298 return Sign::Positive;
299 }
300 Sign::from(self.to_bits() >> $shift > 0)
301 }
302 }
303
304 #[allow(deprecated)]
305 impl AbsEq for $t {
306 #[inline]
307 fn abs_eq(&self, rhs: &Self) -> bool {
308 self.abs() == rhs.abs()
309 }
310 }
311
312 impl AbsOrd for $t {
313 #[inline]
314 fn abs_cmp(&self, rhs: &Self) -> Ordering {
315 self.abs()
316 .partial_cmp(&rhs.abs())
317 .expect("abs_cmp is not allowed on NaNs!")
318 }
319 }
320 };
321 }
322 impl_signed_for_floatrust-analyzer cargo dashu-base 0.4.1 sign/impl_signed_for_float!!(f32, 31);
323 impl_signed_for_floatrust-analyzer cargo dashu-base 0.4.1 sign/impl_signed_for_float!!(f64, 63);
324
325 #[cfg(test)]
326 mod testsrust-analyzer cargo dashu-base 0.4.1 sign/tests/ {
327 use superrust-analyzer cargo dashu-base 0.4.1 sign/::*;
328
329 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
330 fn test_signedrust-analyzer cargo dashu-base 0.4.1 sign/tests/test_signed().() {
331 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(0i32.signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[i32][Signed]sign().(), Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#);
332 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1i32.signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[i32][Signed]sign().(), Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#);
333 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1i32).signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[i32][Signed]sign().(), Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#);
334
335 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(0f32.signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[f32][Signed]sign().(), Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#);
336 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0f32).signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[f32][Signed]sign().(), Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#);
337 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1f32.signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[f32][Signed]sign().(), Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Positiverust-analyzer cargo dashu-base 0.4.1 sign/Sign#Positive#);
338 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1f32).signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[f32][Signed]sign().(), Signrust-analyzer cargo dashu-base 0.4.1 sign/Sign#::Negativerust-analyzer cargo dashu-base 0.4.1 sign/Sign#Negative#);
339 }
340
341 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
342 #[should_panic]
343 fn test_signed_nanrust-analyzer cargo dashu-base 0.4.1 sign/tests/test_signed_nan().() {
344 let _ = f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN..signrust-analyzer cargo dashu-base 0.4.1 sign/impl#[f32][Signed]sign().();
345 }
346
347 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
348 #[should_panic]
349 fn test_abs_cmp_nanrust-analyzer cargo dashu-base 0.4.1 sign/tests/test_abs_cmp_nan().() {
350 let _ = f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN..abs_cmprust-analyzer cargo dashu-base 0.4.1 sign/impl#[f32][`AbsOrd<Self>`]abs_cmp().(&f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN.);
351 }
352 }