@@ -10,10 +10,10 @@ trait GeneralFormat: PartialOrd {
1010}
1111
1212macro_rules! impl_general_format {
13- ( $( $t : ident ) * ) => {
14- $( impl GeneralFormat for $t {
13+ ( $( $ty : ty ) * ) => {
14+ $( impl GeneralFormat for $ty {
1515 fn already_rounded_value_should_use_exponential( & self ) -> bool {
16- let abs = $t :: abs( * self ) ;
16+ let abs = <$ty> :: abs( * self ) ;
1717 ( abs != 0.0 && abs < 1e-4 ) || abs >= 1e+16
1818 }
1919 } ) *
@@ -23,6 +23,8 @@ macro_rules! impl_general_format {
2323#[ cfg( target_has_reliable_f16) ]
2424impl_general_format ! { f16 }
2525impl_general_format ! { f32 f64 }
26+ #[ cfg( target_has_reliable_f128) ]
27+ impl_general_format ! { f128 }
2628
2729// Don't inline this so callers don't use the stack space this function
2830// requires unless they have to.
@@ -198,7 +200,7 @@ where
198200}
199201
200202macro_rules! floating {
201- ( $( $ty: ident ) * ) => {
203+ ( $( $ty: ty ) * ) => {
202204 $(
203205 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
204206 impl Debug for $ty {
@@ -231,10 +233,11 @@ macro_rules! floating {
231233 } ;
232234}
233235
234- floating ! { f32 f64 }
235-
236236#[ cfg( target_has_reliable_f16) ]
237237floating ! { f16 }
238+ floating ! { f32 f64 }
239+ #[ cfg( target_has_reliable_f128) ]
240+ floating ! { f128 }
238241
239242// FIXME(f16_f128): A fallback is used when the backend+target does not support f16 well, in order
240243// to avoid ICEs.
@@ -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" ) ]
279283impl 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