@@ -137,10 +137,8 @@ pub mod consts {
137137 pub const LN_10 : f128 = 2.30258509299404568401799145468436420760110148862877297603333_f128 ;
138138}
139139
140+ #[ doc( test( attr( feature( cfg_target_has_reliable_f16_f128) , allow( internal_features) ) ) ) ]
140141impl f128 {
141- // FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const
142- // implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE.
143-
144142 /// The radix or base of the internal representation of `f128`.
145143 #[ unstable( feature = "f128" , issue = "116909" ) ]
146144 pub const RADIX : u32 = 2 ;
@@ -277,8 +275,7 @@ impl f128 {
277275 ///
278276 /// ```
279277 /// #![feature(f128)]
280- /// # // FIXME(f16_f128): remove when `unordtf2` is available
281- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
278+ /// # #[cfg(target_has_reliable_f128)] {
282279 ///
283280 /// let nan = f128::NAN;
284281 /// let f = 7.0_f128;
@@ -300,8 +297,7 @@ impl f128 {
300297 ///
301298 /// ```
302299 /// #![feature(f128)]
303- /// # // FIXME(f16_f128): remove when `eqtf2` is available
304- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
300+ /// # #[cfg(target_has_reliable_f128)] {
305301 ///
306302 /// let f = 7.0f128;
307303 /// let inf = f128::INFINITY;
@@ -326,8 +322,7 @@ impl f128 {
326322 ///
327323 /// ```
328324 /// #![feature(f128)]
329- /// # // FIXME(f16_f128): remove when `lttf2` is available
330- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
325+ /// # #[cfg(target_has_reliable_f128)] {
331326 ///
332327 /// let f = 7.0f128;
333328 /// let inf: f128 = f128::INFINITY;
@@ -355,8 +350,7 @@ impl f128 {
355350 ///
356351 /// ```
357352 /// #![feature(f128)]
358- /// # // FIXME(f16_f128): remove when `eqtf2` is available
359- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
353+ /// # #[cfg(target_has_reliable_f128)] {
360354 ///
361355 /// let min = f128::MIN_POSITIVE; // 3.362103143e-4932f128
362356 /// let max = f128::MAX;
@@ -386,8 +380,7 @@ impl f128 {
386380 ///
387381 /// ```
388382 /// #![feature(f128)]
389- /// # // FIXME(f16_f128): remove when `eqtf2` is available
390- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
383+ /// # #[cfg(target_has_reliable_f128)] {
391384 ///
392385 /// let min = f128::MIN_POSITIVE; // 3.362103143e-4932f128
393386 /// let max = f128::MAX;
@@ -419,8 +412,7 @@ impl f128 {
419412 ///
420413 /// ```
421414 /// #![feature(f128)]
422- /// # // FIXME(f16_f128): remove when `eqtf2` is available
423- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
415+ /// # #[cfg(target_has_reliable_f128)] {
424416 ///
425417 /// use std::num::FpCategory;
426418 ///
@@ -514,8 +506,7 @@ impl f128 {
514506 ///
515507 /// ```rust
516508 /// #![feature(f128)]
517- /// # // FIXME(f16_f128): remove when `eqtf2` is available
518- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
509+ /// # #[cfg(target_has_reliable_f128)] {
519510 ///
520511 /// // f128::EPSILON is the difference between 1.0 and the next number up.
521512 /// assert_eq!(1.0f128.next_up(), 1.0 + f128::EPSILON);
@@ -569,8 +560,7 @@ impl f128 {
569560 ///
570561 /// ```rust
571562 /// #![feature(f128)]
572- /// # // FIXME(f16_f128): remove when `eqtf2` is available
573- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
563+ /// # #[cfg(target_has_reliable_f128)] {
574564 ///
575565 /// let x = 1.0f128;
576566 /// // Clamp value into range [0, 1).
@@ -613,8 +603,7 @@ impl f128 {
613603 ///
614604 /// ```
615605 /// #![feature(f128)]
616- /// # // FIXME(f16_f128): remove when `eqtf2` is available
617- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
606+ /// # #[cfg(target_has_reliable_f128)] {
618607 ///
619608 /// let x = 2.0_f128;
620609 /// let abs_difference = (x.recip() - (1.0 / x)).abs();
@@ -640,8 +629,7 @@ impl f128 {
640629 ///
641630 /// ```
642631 /// #![feature(f128)]
643- /// # // FIXME(f16_f128): remove when `eqtf2` is available
644- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
632+ /// # #[cfg(target_has_reliable_f128)] {
645633 ///
646634 /// let angle = std::f128::consts::PI;
647635 ///
@@ -671,8 +659,7 @@ impl f128 {
671659 ///
672660 /// ```
673661 /// #![feature(f128)]
674- /// # // FIXME(f16_f128): remove when `eqtf2` is available
675- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
662+ /// # #[cfg(target_has_reliable_f128)] {
676663 ///
677664 /// let angle = 180.0f128;
678665 ///
@@ -706,8 +693,7 @@ impl f128 {
706693 ///
707694 /// ```
708695 /// #![feature(f128)]
709- /// # // Using aarch64 because `reliable_f128_math` is needed
710- /// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
696+ /// # #[cfg(target_has_reliable_f128_math)] {
711697 ///
712698 /// let x = 1.0f128;
713699 /// let y = 2.0f128;
@@ -738,8 +724,7 @@ impl f128 {
738724 ///
739725 /// ```
740726 /// #![feature(f128)]
741- /// # // Using aarch64 because `reliable_f128_math` is needed
742- /// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
727+ /// # #[cfg(target_has_reliable_f128_math)] {
743728 ///
744729 /// let x = 1.0f128;
745730 /// let y = 2.0f128;
@@ -771,8 +756,7 @@ impl f128 {
771756 /// ```
772757 /// #![feature(f128)]
773758 /// #![feature(float_minimum_maximum)]
774- /// # // Using aarch64 because `reliable_f128_math` is needed
775- /// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
759+ /// # #[cfg(target_has_reliable_f128_math)] {
776760 ///
777761 /// let x = 1.0f128;
778762 /// let y = 2.0f128;
@@ -804,8 +788,7 @@ impl f128 {
804788 /// ```
805789 /// #![feature(f128)]
806790 /// #![feature(float_minimum_maximum)]
807- /// # // Using aarch64 because `reliable_f128_math` is needed
808- /// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
791+ /// # #[cfg(target_has_reliable_f128_math)] {
809792 ///
810793 /// let x = 1.0f128;
811794 /// let y = 2.0f128;
@@ -831,8 +814,7 @@ impl f128 {
831814 ///
832815 /// ```
833816 /// #![feature(f128)]
834- /// # // Using aarch64 because `reliable_f128_math` is needed
835- /// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
817+ /// # #[cfg(target_has_reliable_f128)] {
836818 ///
837819 /// assert_eq!(1f128.midpoint(4.0), 2.5);
838820 /// assert_eq!((-5.5f128).midpoint(8.0), 1.25);
@@ -862,8 +844,7 @@ impl f128 {
862844 ///
863845 /// ```
864846 /// #![feature(f128)]
865- /// # // FIXME(f16_f128): remove when `float*itf` is available
866- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
847+ /// # #[cfg(target_has_reliable_f128)] {
867848 ///
868849 /// let value = 4.6_f128;
869850 /// let rounded = unsafe { value.to_int_unchecked::<u16>() };
@@ -906,10 +887,11 @@ impl f128 {
906887 ///
907888 /// ```
908889 /// #![feature(f128)]
890+ /// # #[cfg(target_has_reliable_f128)] {
909891 ///
910- /// # // FIXME(f16_f128): enable this once const casting works
911- /// # // assert_ne!((1f128).to_bits(), 1f128 as u128); // to_bits() is not casting!
892+ /// assert_ne!((1f128).to_bits(), 1f128 as u128); // to_bits() is not casting!
912893 /// assert_eq!((12.5f128).to_bits(), 0x40029000000000000000000000000000);
894+ /// # }
913895 /// ```
914896 #[ inline]
915897 #[ unstable( feature = "f128" , issue = "116909" ) ]
@@ -952,8 +934,7 @@ impl f128 {
952934 ///
953935 /// ```
954936 /// #![feature(f128)]
955- /// # // FIXME(f16_f128): remove when `eqtf2` is available
956- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
937+ /// # #[cfg(target_has_reliable_f128)] {
957938 ///
958939 /// let v = f128::from_bits(0x40029000000000000000000000000000);
959940 /// assert_eq!(v, 12.5);
@@ -1064,8 +1045,7 @@ impl f128 {
10641045 ///
10651046 /// ```
10661047 /// #![feature(f128)]
1067- /// # // FIXME(f16_f128): remove when `eqtf2` is available
1068- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
1048+ /// # #[cfg(target_has_reliable_f128)] {
10691049 ///
10701050 /// let value = f128::from_be_bytes(
10711051 /// [0x40, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1090,8 +1070,7 @@ impl f128 {
10901070 ///
10911071 /// ```
10921072 /// #![feature(f128)]
1093- /// # // FIXME(f16_f128): remove when `eqtf2` is available
1094- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
1073+ /// # #[cfg(target_has_reliable_f128)] {
10951074 ///
10961075 /// let value = f128::from_le_bytes(
10971076 /// [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1123,8 +1102,7 @@ impl f128 {
11231102 ///
11241103 /// ```
11251104 /// #![feature(f128)]
1126- /// # // FIXME(f16_f128): remove when `eqtf2` is available
1127- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
1105+ /// # #[cfg(target_has_reliable_f128)] {
11281106 ///
11291107 /// let value = f128::from_ne_bytes(if cfg!(target_endian = "big") {
11301108 /// [0x40, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1257,8 +1235,7 @@ impl f128 {
12571235 ///
12581236 /// ```
12591237 /// #![feature(f128)]
1260- /// # // FIXME(f16_f128): remove when `{eq,gt,unord}tf` are available
1261- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
1238+ /// # #[cfg(target_has_reliable_f128)] {
12621239 ///
12631240 /// assert!((-3.0f128).clamp(-2.0, 1.0) == -2.0);
12641241 /// assert!((0.0f128).clamp(-2.0, 1.0) == 0.0);
@@ -1333,7 +1310,7 @@ impl f128 {
13331310 ///
13341311 /// ```
13351312 /// #![feature(f128)]
1336- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux") )] {
1313+ /// # #[cfg(target_has_reliable_f128 )] {
13371314 ///
13381315 /// let x = 3.5_f128;
13391316 /// let y = -3.5_f128;
@@ -1349,9 +1326,7 @@ impl f128 {
13491326 #[ rustc_const_unstable( feature = "f128" , issue = "116909" ) ]
13501327 #[ must_use = "method returns a new number and does not mutate the original value" ]
13511328 pub const fn abs ( self ) -> Self {
1352- // FIXME(f16_f128): replace with `intrinsics::fabsf128` when available
1353- // We don't do this now because LLVM has lowering bugs for f128 math.
1354- Self :: from_bits ( self . to_bits ( ) & !( 1 << 127 ) )
1329+ intrinsics:: fabsf128 ( self )
13551330 }
13561331
13571332 /// Returns a number that represents the sign of `self`.
@@ -1364,7 +1339,7 @@ impl f128 {
13641339 ///
13651340 /// ```
13661341 /// #![feature(f128)]
1367- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux") )] {
1342+ /// # #[cfg(target_has_reliable_f128 )] {
13681343 ///
13691344 /// let f = 3.5_f128;
13701345 ///
@@ -1400,7 +1375,7 @@ impl f128 {
14001375 ///
14011376 /// ```
14021377 /// #![feature(f128)]
1403- /// # #[cfg(all(target_arch = "x86_64", target_os = "linux") )] {
1378+ /// # #[cfg(target_has_reliable_f128 )] {
14041379 ///
14051380 /// let f = 3.5_f128;
14061381 ///
@@ -1477,8 +1452,6 @@ impl f128 {
14771452}
14781453
14791454// Functions in this module fall into `core_float_math`
1480- // FIXME(f16_f128): all doctests must be gated to platforms that have `long double` === `_Float128`
1481- // due to https://github.com/llvm/llvm-project/issues/44744. aarch64 linux matches this.
14821455// #[unstable(feature = "core_float_math", issue = "137578")]
14831456#[ cfg( not( test) ) ]
14841457#[ doc( test( attr( feature( cfg_target_has_reliable_f16_f128) , expect( internal_features) ) ) ) ]
0 commit comments