Skip to content

Commit 79f104c

Browse files
committed
Implement 'Display', 'LowerExp', and 'UpperExp' for 'f128';
1 parent 7ad23f4 commit 79f104c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

library/core/src/fmt/float.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ floating! { f32 f64 }
236236
#[cfg(target_has_reliable_f16)]
237237
floating! { f16 }
238238

239+
#[cfg(target_has_reliable_f128)]
240+
floating! { f128 }
241+
239242
// FIXME(f16_f128): A fallback is used when the backend+target does not support f16 well, in order
240243
// to avoid ICEs.
241244

@@ -275,10 +278,38 @@ impl UpperExp for f16 {
275278
}
276279
}
277280

281+
#[cfg(not(target_has_reliable_f128))]
278282
#[stable(feature = "rust1", since = "1.0.0")]
279283
impl Debug for f128 {
280284
#[inline]
281285
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
282286
write!(f, "{:#034x}", self.to_bits())
283287
}
284288
}
289+
290+
#[cfg(not(target_has_reliable_f128))]
291+
#[stable(feature = "rust1", since = "1.0.0")]
292+
impl Display for f128 {
293+
#[inline]
294+
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
295+
Debug::fmt(self, fmt)
296+
}
297+
}
298+
299+
#[cfg(not(target_has_reliable_f128))]
300+
#[stable(feature = "rust1", since = "1.0.0")]
301+
impl LowerExp for f128 {
302+
#[inline]
303+
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
304+
Debug::fmt(self, fmt)
305+
}
306+
}
307+
308+
#[cfg(not(target_has_reliable_f128))]
309+
#[stable(feature = "rust1", since = "1.0.0")]
310+
impl UpperExp for f128 {
311+
#[inline]
312+
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
313+
Debug::fmt(self, fmt)
314+
}
315+
}

0 commit comments

Comments
 (0)