File tree Expand file tree Collapse file tree 2 files changed +26
-24
lines changed Expand file tree Collapse file tree 2 files changed +26
-24
lines changed Original file line number Diff line number Diff line change @@ -551,9 +551,22 @@ impl Float for f32 {
551
551
#[ inline( always) ]
552
552
fn neg_zero ( ) -> f32 { -0.0 }
553
553
554
+ /// Returns `true` if the number is NaN
554
555
#[ inline( always) ]
555
556
fn is_NaN ( & self ) -> bool { * self != * self }
556
557
558
+ /// Returns `true` if the number is infinite
559
+ #[ inline( always) ]
560
+ fn is_infinite ( & self ) -> bool {
561
+ * self == Float :: infinity ( ) || * self == Float :: neg_infinity ( )
562
+ }
563
+
564
+ /// Returns `true` if the number is not infinite or NaN
565
+ #[ inline( always) ]
566
+ fn is_finite ( & self ) -> bool {
567
+ !( self . is_NaN ( ) || self . is_infinite ( ) )
568
+ }
569
+
557
570
#[ inline( always) ]
558
571
fn mantissa_digits ( ) -> uint { 24 }
559
572
@@ -575,18 +588,6 @@ impl Float for f32 {
575
588
#[ inline( always) ]
576
589
fn max_10_exp ( ) -> int { 38 }
577
590
578
- /// Returns `true` if the number is infinite
579
- #[ inline( always) ]
580
- fn is_infinite ( & self ) -> bool {
581
- * self == Float :: infinity ( ) || * self == Float :: neg_infinity ( )
582
- }
583
-
584
- /// Returns `true` if the number is finite
585
- #[ inline( always) ]
586
- fn is_finite ( & self ) -> bool {
587
- !( self . is_NaN ( ) || self . is_infinite ( ) )
588
- }
589
-
590
591
///
591
592
/// Returns the exponential of the number, minus `1`, in a way that is accurate
592
593
/// even if the number is close to zero
Original file line number Diff line number Diff line change @@ -784,9 +784,22 @@ impl Float for float {
784
784
#[inline(always)]
785
785
fn neg_zero() -> float { -0.0 }
786
786
787
+ /// Returns `true` if the number is NaN
787
788
#[inline(always)]
788
789
fn is_NaN(&self) -> bool { *self != *self }
789
790
791
+ /// Returns `true` if the number is infinite
792
+ #[inline(always)]
793
+ fn is_infinite(&self) -> bool {
794
+ *self == Float::infinity() || *self == Float::neg_infinity()
795
+ }
796
+
797
+ /// Returns `true` if the number is not infinite or NaN
798
+ #[inline(always)]
799
+ fn is_finite(&self) -> bool {
800
+ !(self.is_NaN() || self.is_infinite())
801
+ }
802
+
790
803
#[inline(always)]
791
804
fn mantissa_digits() -> uint { Float::mantissa_digits::<f64>() }
792
805
@@ -808,18 +821,6 @@ impl Float for float {
808
821
#[inline(always)]
809
822
fn max_10_exp() -> int { Float::max_10_exp::<f64>() }
810
823
811
- /// Returns `true` if the number is infinite
812
- #[inline(always)]
813
- fn is_infinite(&self) -> bool {
814
- *self == Float::infinity() || *self == Float::neg_infinity()
815
- }
816
-
817
- /// Returns `true` if the number is finite
818
- #[inline(always)]
819
- fn is_finite(&self) -> bool {
820
- !(self.is_NaN() || self.is_infinite())
821
- }
822
-
823
824
///
824
825
/// Returns the exponential of the number, minus `1`, in a way that is accurate
825
826
/// even if the number is close to zero
You can’t perform that action at this time.
0 commit comments