This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -1594,6 +1594,12 @@ extern "rust-intrinsic" {
15941594 #[ rustc_nounwind]
15951595 pub fn sqrtf64 ( x : f64 ) -> f64 ;
15961596
1597+ /// Raises an `f16` to an integer power.
1598+ ///
1599+ /// The stabilized version of this intrinsic is
1600+ /// [`f16::powi`](../../std/primitive.f16.html#method.powi)
1601+ #[ rustc_nounwind]
1602+ pub fn powif16 ( a : f16 , x : i32 ) -> f16 ;
15971603 /// Raises an `f32` to an integer power.
15981604 ///
15991605 /// The stabilized version of this intrinsic is
@@ -1606,6 +1612,12 @@ extern "rust-intrinsic" {
16061612 /// [`f64::powi`](../../std/primitive.f64.html#method.powi)
16071613 #[ rustc_nounwind]
16081614 pub fn powif64 ( a : f64 , x : i32 ) -> f64 ;
1615+ /// Raises an `f128` to an integer power.
1616+ ///
1617+ /// The stabilized version of this intrinsic is
1618+ /// [`f128::powi`](../../std/primitive.f128.html#method.powi)
1619+ #[ rustc_nounwind]
1620+ pub fn powif128 ( a : f128 , x : i32 ) -> f128 ;
16091621
16101622 /// Returns the sine of an `f32`.
16111623 ///
Original file line number Diff line number Diff line change 77#[ cfg( test) ]
88mod tests;
99
10+ #[ cfg( not( test) ) ]
11+ use crate :: intrinsics;
12+
1013#[ unstable( feature = "f128" , issue = "116909" ) ]
1114pub use core:: f128:: consts;
15+
16+ #[ cfg( not( test) ) ]
17+ impl f128 {
18+ /// Raises a number to an integer power.
19+ ///
20+ /// Using this function is generally faster than using `powf`.
21+ /// It might have a different sequence of rounding operations than `powf`,
22+ /// so the results are not guaranteed to agree.
23+ ///
24+ /// # Unspecified precision
25+ ///
26+ /// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
27+ /// can even differ within the same execution from one invocation to the next.
28+ #[ inline]
29+ #[ rustc_allow_incoherent_impl]
30+ #[ unstable( feature = "f128" , issue = "116909" ) ]
31+ #[ must_use = "method returns a new number and does not mutate the original value" ]
32+ pub fn powi ( self , n : i32 ) -> f128 {
33+ unsafe { intrinsics:: powif128 ( self , n) }
34+ }
35+ }
Original file line number Diff line number Diff line change 77#[ cfg( test) ]
88mod tests;
99
10+ #[ cfg( not( test) ) ]
11+ use crate :: intrinsics;
12+
1013#[ unstable( feature = "f16" , issue = "116909" ) ]
1114pub use core:: f16:: consts;
15+
16+ #[ cfg( not( test) ) ]
17+ impl f16 {
18+ /// Raises a number to an integer power.
19+ ///
20+ /// Using this function is generally faster than using `powf`.
21+ /// It might have a different sequence of rounding operations than `powf`,
22+ /// so the results are not guaranteed to agree.
23+ ///
24+ /// # Unspecified precision
25+ ///
26+ /// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
27+ /// can even differ within the same execution from one invocation to the next.
28+ #[ inline]
29+ #[ rustc_allow_incoherent_impl]
30+ #[ unstable( feature = "f16" , issue = "116909" ) ]
31+ #[ must_use = "method returns a new number and does not mutate the original value" ]
32+ pub fn powi ( self , n : i32 ) -> f16 {
33+ unsafe { intrinsics:: powif16 ( self , n) }
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments