Skip to content

Commit 1ceb26b

Browse files
committed
Rollup merge of rust-lang#22631 - aepsil0n:issue-22098, r=aturon
Fixes rust-lang#22098.
2 parents baf6b3a + 5bfb5ba commit 1ceb26b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/libstd/num/f32.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ impl Float for f32 {
191191
/// Constructs a floating point number by multiplying `x` by 2 raised to the
192192
/// power of `exp`
193193
#[inline]
194-
fn ldexp(x: f32, exp: int) -> f32 {
195-
unsafe { cmath::ldexpf(x, exp as c_int) }
194+
fn ldexp(self, exp: isize) -> f32 {
195+
unsafe { cmath::ldexpf(self, exp as c_int) }
196196
}
197197

198198
/// Breaks the number into a normalized fraction and a base-2 exponent,
@@ -2207,8 +2207,8 @@ mod tests {
22072207
let f1: f32 = FromStrRadix::from_str_radix("1p-123", 16).unwrap();
22082208
let f2: f32 = FromStrRadix::from_str_radix("1p-111", 16).unwrap();
22092209
let f3: f32 = FromStrRadix::from_str_radix("1.Cp-12", 16).unwrap();
2210-
assert_eq!(Float::ldexp(1f32, -123), f1);
2211-
assert_eq!(Float::ldexp(1f32, -111), f2);
2210+
assert_eq!(1f32.ldexp(-123), f1);
2211+
assert_eq!(1f32.ldexp(-111), f2);
22122212
assert_eq!(Float::ldexp(1.75f32, -12), f3);
22132213

22142214
assert_eq!(Float::ldexp(0f32, -123), 0f32);

src/libstd/num/f64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ impl Float for f64 {
200200
fn to_radians(self) -> f64 { num::Float::to_radians(self) }
201201

202202
#[inline]
203-
fn ldexp(x: f64, exp: int) -> f64 {
204-
unsafe { cmath::ldexp(x, exp as c_int) }
203+
fn ldexp(self, exp: isize) -> f64 {
204+
unsafe { cmath::ldexp(self, exp as c_int) }
205205
}
206206

207207
/// Breaks the number into a normalized fraction and a base-2 exponent,
@@ -2214,8 +2214,8 @@ mod tests {
22142214
let f1: f64 = FromStrRadix::from_str_radix("1p-123", 16).unwrap();
22152215
let f2: f64 = FromStrRadix::from_str_radix("1p-111", 16).unwrap();
22162216
let f3: f64 = FromStrRadix::from_str_radix("1.Cp-12", 16).unwrap();
2217-
assert_eq!(Float::ldexp(1f64, -123), f1);
2218-
assert_eq!(Float::ldexp(1f64, -111), f2);
2217+
assert_eq!(1f64.ldexp(-123), f1);
2218+
assert_eq!(1f64.ldexp(-111), f2);
22192219
assert_eq!(Float::ldexp(1.75f64, -12), f3);
22202220

22212221
assert_eq!(Float::ldexp(0f64, -123), 0f64);

src/libstd/num/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ pub trait Float
699699
/// ```
700700
#[unstable(feature = "std_misc",
701701
reason = "pending integer conventions")]
702-
fn ldexp(x: Self, exp: isize) -> Self;
702+
fn ldexp(self, exp: isize) -> Self;
703703
/// Breaks the number into a normalized fraction and a base-2 exponent,
704704
/// satisfying:
705705
///

0 commit comments

Comments
 (0)