about summary refs log tree commit diff
path: root/src/libstd/num/f32.rs
diff options
context:
space:
mode:
authorTobias Bucher <tobiasbucher5991@gmail.com>2014-12-22 22:50:57 +0100
committerTobias Bucher <tobiasbucher5991@gmail.com>2014-12-23 13:42:09 +0100
commit16f01cc13f6a092873096c44eed546561b88d245 (patch)
tree878df21a28ad63754019346cf9a390bb0bb9eabe /src/libstd/num/f32.rs
parent658529467d9d69ac9e09cacf98a6d61d781c2c76 (diff)
downloadrust-16f01cc13f6a092873096c44eed546561b88d245.tar.gz
rust-16f01cc13f6a092873096c44eed546561b88d245.zip
Rename and namespace `FPCategory`
Rename `FPCategory` to `FpCategory` and `Fp* to `*` in order to adhere to the
naming convention

This is a [breaking-change].

Existing code like this:
```
use std::num::{FPCategory, FPNaN};
```
should be adjusted to this:
```
use std::num::FpCategory as Fp
```

In the following code you can use the constants `Fp::Nan`, `Fp::Normal`, etc.
Diffstat (limited to 'src/libstd/num/f32.rs')
-rw-r--r--src/libstd/num/f32.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index 951627b26ca..1f76382ce8a 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -351,6 +351,7 @@ pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String {
 mod tests {
     use f32::*;
     use num::*;
+    use num::FpCategory as Fp;
 
     #[test]
     fn test_min_nan() {
@@ -620,14 +621,14 @@ mod tests {
         let neg_inf: f32 = Float::neg_infinity();
         let zero: f32 = Float::zero();
         let neg_zero: f32 = Float::neg_zero();
-        assert_eq!(nan.classify(), FPNaN);
-        assert_eq!(inf.classify(), FPInfinite);
-        assert_eq!(neg_inf.classify(), FPInfinite);
-        assert_eq!(zero.classify(), FPZero);
-        assert_eq!(neg_zero.classify(), FPZero);
-        assert_eq!(1f32.classify(), FPNormal);
-        assert_eq!(1e-37f32.classify(), FPNormal);
-        assert_eq!(1e-38f32.classify(), FPSubnormal);
+        assert_eq!(nan.classify(), Fp::Nan);
+        assert_eq!(inf.classify(), Fp::Infinite);
+        assert_eq!(neg_inf.classify(), Fp::Infinite);
+        assert_eq!(zero.classify(), Fp::Zero);
+        assert_eq!(neg_zero.classify(), Fp::Zero);
+        assert_eq!(1f32.classify(), Fp::Normal);
+        assert_eq!(1e-37f32.classify(), Fp::Normal);
+        assert_eq!(1e-38f32.classify(), Fp::Subnormal);
     }
 
     #[test]