@@ -323,41 +323,39 @@ pub trait Float
323
323
/// ```
324
324
fn signum ( self ) -> Self ;
325
325
326
- /// Returns `true` if `self` is positive, including `+0.0` and
327
- /// `Float::infinity()`.
326
+ /// Returns `true` if `self` is positive, including `+0.0`,
327
+ /// `Float::infinity()`, and with newer versions of Rust `f64::NAN` .
328
328
///
329
329
/// ```
330
330
/// use num_traits::Float;
331
331
/// use std::f64;
332
332
///
333
- /// let nan : f64 = f64::NAN;
333
+ /// let neg_nan : f64 = - f64::NAN;
334
334
///
335
335
/// let f = 7.0;
336
336
/// let g = -7.0;
337
337
///
338
338
/// assert!(f.is_sign_positive());
339
339
/// assert!(!g.is_sign_positive());
340
- /// // Requires both tests to determine if is `NaN`
341
- /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative());
340
+ /// assert!(!neg_nan.is_sign_positive());
342
341
/// ```
343
342
fn is_sign_positive ( self ) -> bool ;
344
343
345
- /// Returns `true` if `self` is negative, including `-0.0` and
346
- /// `Float::neg_infinity()`.
344
+ /// Returns `true` if `self` is negative, including `-0.0`,
345
+ /// `Float::neg_infinity()`, and with newer versions of Rust `-f64::NAN` .
347
346
///
348
347
/// ```
349
348
/// use num_traits::Float;
350
349
/// use std::f64;
351
350
///
352
- /// let nan = f64::NAN;
351
+ /// let nan: f64 = f64::NAN;
353
352
///
354
353
/// let f = 7.0;
355
354
/// let g = -7.0;
356
355
///
357
356
/// assert!(!f.is_sign_negative());
358
357
/// assert!(g.is_sign_negative());
359
- /// // Requires both tests to determine if is `NaN`.
360
- /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative());
358
+ /// assert!(!nan.is_sign_negative());
361
359
/// ```
362
360
fn is_sign_negative ( self ) -> bool ;
363
361
0 commit comments