summary refs log tree commit diff
path: root/src/libstd/num/f32.rs
diff options
context:
space:
mode:
authorEduard Bopp <eduard.bopp@aepsil0n.de>2015-02-21 15:05:34 +0100
committerEduard Bopp <eduard.bopp@aepsil0n.de>2015-03-19 14:00:00 +0100
commit5bfb5bab9a2b2e0ec7797ae8cc4486ba41ea98d4 (patch)
tree4c384427f62cc09132fd444decf674cc6ae91936 /src/libstd/num/f32.rs
parent46f649c479ce40f3b4590590dda6c2895e8d60f6 (diff)
Allow Float::ldexp to be called as a method
Fixes #22098.
Diffstat (limited to 'src/libstd/num/f32.rs')
-rw-r--r--src/libstd/num/f32.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index a7825c4f93a..bbe08080c60 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -191,8 +191,8 @@ impl Float for f32 {
     /// Constructs a floating point number by multiplying `x` by 2 raised to the
     /// power of `exp`
     #[inline]
-    fn ldexp(x: f32, exp: int) -> f32 {
-        unsafe { cmath::ldexpf(x, exp as c_int) }
+    fn ldexp(self, exp: isize) -> f32 {
+        unsafe { cmath::ldexpf(self, exp as c_int) }
     }
 
     /// Breaks the number into a normalized fraction and a base-2 exponent,
@@ -2208,8 +2208,8 @@ mod tests {
         let f1: f32 = FromStrRadix::from_str_radix("1p-123", 16).unwrap();
         let f2: f32 = FromStrRadix::from_str_radix("1p-111", 16).unwrap();
         let f3: f32 = FromStrRadix::from_str_radix("1.Cp-12", 16).unwrap();
-        assert_eq!(Float::ldexp(1f32, -123), f1);
-        assert_eq!(Float::ldexp(1f32, -111), f2);
+        assert_eq!(1f32.ldexp(-123), f1);
+        assert_eq!(1f32.ldexp(-111), f2);
         assert_eq!(Float::ldexp(1.75f32, -12), f3);
 
         assert_eq!(Float::ldexp(0f32, -123), 0f32);