Skip to content

Commit 3b22215

Browse files
committed
Move to core.
1 parent 8cfeb9d commit 3b22215

File tree

4 files changed

+80
-100
lines changed

4 files changed

+80
-100
lines changed

library/core/src/num/f32.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,4 +1506,44 @@ impl f32 {
15061506
// SAFETY: this is actually a safe intrinsic
15071507
unsafe { intrinsics::copysignf32(self, sign) }
15081508
}
1509+
1510+
/// Float addition that allows optimizations based on algebraic rules.
1511+
#[must_use = "method returns a new number and does not mutate the original value"]
1512+
#[unstable(feature = "float_algebraic", issue = "21690")]
1513+
#[inline]
1514+
pub fn add_algebraic(self, rhs: f32) -> f32 {
1515+
intrinsics::fadd_algebraic(self, rhs)
1516+
}
1517+
1518+
/// Float subtraction that allows optimizations based on algebraic rules.
1519+
#[must_use = "method returns a new number and does not mutate the original value"]
1520+
#[unstable(feature = "float_algebraic", issue = "21690")]
1521+
#[inline]
1522+
pub fn sub_algebraic(self, rhs: f32) -> f32 {
1523+
intrinsics::fsub_algebraic(self, rhs)
1524+
}
1525+
1526+
/// Float multiplication that allows optimizations based on algebraic rules.
1527+
#[must_use = "method returns a new number and does not mutate the original value"]
1528+
#[unstable(feature = "float_algebraic", issue = "21690")]
1529+
#[inline]
1530+
pub fn mul_algebraic(self, rhs: f32) -> f32 {
1531+
intrinsics::fmul_algebraic(self, rhs)
1532+
}
1533+
1534+
/// Float division that allows optimizations based on algebraic rules.
1535+
#[must_use = "method returns a new number and does not mutate the original value"]
1536+
#[unstable(feature = "float_algebraic", issue = "21690")]
1537+
#[inline]
1538+
pub fn div_algebraic(self, rhs: f32) -> f32 {
1539+
intrinsics::fdiv_algebraic(self, rhs)
1540+
}
1541+
1542+
/// Float remainder that allows optimizations based on algebraic rules.
1543+
#[must_use = "method returns a new number and does not mutate the original value"]
1544+
#[unstable(feature = "float_algebraic", issue = "21690")]
1545+
#[inline]
1546+
pub fn rem_algebraic(self, rhs: f32) -> f32 {
1547+
intrinsics::frem_algebraic(self, rhs)
1548+
}
15091549
}

library/core/src/num/f64.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,4 +1506,44 @@ impl f64 {
15061506
// SAFETY: this is actually a safe intrinsic
15071507
unsafe { intrinsics::copysignf64(self, sign) }
15081508
}
1509+
1510+
/// Float addition that allows optimizations based on algebraic rules.
1511+
#[must_use = "method returns a new number and does not mutate the original value"]
1512+
#[unstable(feature = "float_algebraic", issue = "21690")]
1513+
#[inline]
1514+
pub fn add_algebraic(self, rhs: f64) -> f64 {
1515+
intrinsics::fadd_algebraic(self, rhs)
1516+
}
1517+
1518+
/// Float subtraction that allows optimizations based on algebraic rules.
1519+
#[must_use = "method returns a new number and does not mutate the original value"]
1520+
#[unstable(feature = "float_algebraic", issue = "21690")]
1521+
#[inline]
1522+
pub fn sub_algebraic(self, rhs: f64) -> f64 {
1523+
intrinsics::fsub_algebraic(self, rhs)
1524+
}
1525+
1526+
/// Float multiplication that allows optimizations based on algebraic rules.
1527+
#[must_use = "method returns a new number and does not mutate the original value"]
1528+
#[unstable(feature = "float_algebraic", issue = "21690")]
1529+
#[inline]
1530+
pub fn mul_algebraic(self, rhs: f64) -> f64 {
1531+
intrinsics::fmul_algebraic(self, rhs)
1532+
}
1533+
1534+
/// Float division that allows optimizations based on algebraic rules.
1535+
#[must_use = "method returns a new number and does not mutate the original value"]
1536+
#[unstable(feature = "float_algebraic", issue = "21690")]
1537+
#[inline]
1538+
pub fn div_algebraic(self, rhs: f64) -> f64 {
1539+
intrinsics::fdiv_algebraic(self, rhs)
1540+
}
1541+
1542+
/// Float remainder that allows optimizations based on algebraic rules.
1543+
#[must_use = "method returns a new number and does not mutate the original value"]
1544+
#[unstable(feature = "float_algebraic", issue = "21690")]
1545+
#[inline]
1546+
pub fn rem_algebraic(self, rhs: f64) -> f64 {
1547+
intrinsics::frem_algebraic(self, rhs)
1548+
}
15091549
}

library/std/src/f32.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,54 +1154,4 @@ impl f32 {
11541154
let x = unsafe { cmath::lgammaf_r(self, &mut signgamp) };
11551155
(x, signgamp)
11561156
}
1157-
1158-
/// Float addition that allows optimizations based on algebraic rules.
1159-
#[rustc_allow_incoherent_impl]
1160-
#[doc(alias = "fadd_algebraic", alias = "addAlgebraic")]
1161-
#[must_use = "method returns a new number and does not mutate the original value"]
1162-
#[unstable(feature = "float_algebraic", issue = "21690")]
1163-
#[inline]
1164-
pub fn add_algebraic(self, rhs: f32) -> f32 {
1165-
intrinsics::fadd_algebraic(self, rhs)
1166-
}
1167-
1168-
/// Float subtraction that allows optimizations based on algebraic rules.
1169-
#[rustc_allow_incoherent_impl]
1170-
#[doc(alias = "fsub_algebraic", alias = "subAlgebraic")]
1171-
#[must_use = "method returns a new number and does not mutate the original value"]
1172-
#[unstable(feature = "float_algebraic", issue = "21690")]
1173-
#[inline]
1174-
pub fn sub_algebraic(self, rhs: f32) -> f32 {
1175-
intrinsics::fsub_algebraic(self, rhs)
1176-
}
1177-
1178-
/// Float multiplication that allows optimizations based on algebraic rules.
1179-
#[rustc_allow_incoherent_impl]
1180-
#[doc(alias = "fmul_algebraic", alias = "mulAlgebraic")]
1181-
#[must_use = "method returns a new number and does not mutate the original value"]
1182-
#[unstable(feature = "float_algebraic", issue = "21690")]
1183-
#[inline]
1184-
pub fn mul_algebraic(self, rhs: f32) -> f32 {
1185-
intrinsics::fmul_algebraic(self, rhs)
1186-
}
1187-
1188-
/// Float division that allows optimizations based on algebraic rules.
1189-
#[rustc_allow_incoherent_impl]
1190-
#[doc(alias = "fdiv_algebraic", alias = "divAlgebraic")]
1191-
#[must_use = "method returns a new number and does not mutate the original value"]
1192-
#[unstable(feature = "float_algebraic", issue = "21690")]
1193-
#[inline]
1194-
pub fn div_algebraic(self, rhs: f32) -> f32 {
1195-
intrinsics::fdiv_algebraic(self, rhs)
1196-
}
1197-
1198-
/// Float remainder that allows optimizations based on algebraic rules.
1199-
#[rustc_allow_incoherent_impl]
1200-
#[doc(alias = "frem_algebraic", alias = "remAlgebraic")]
1201-
#[must_use = "method returns a new number and does not mutate the original value"]
1202-
#[unstable(feature = "float_algebraic", issue = "21690")]
1203-
#[inline]
1204-
pub fn rem_algebraic(self, rhs: f32) -> f32 {
1205-
intrinsics::frem_algebraic(self, rhs)
1206-
}
12071157
}

library/std/src/f64.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,54 +1154,4 @@ impl f64 {
11541154
let x = unsafe { cmath::lgamma_r(self, &mut signgamp) };
11551155
(x, signgamp)
11561156
}
1157-
1158-
/// Float addition that allows optimizations based on algebraic rules.
1159-
#[rustc_allow_incoherent_impl]
1160-
#[doc(alias = "fadd_algebraic", alias = "addAlgebraic")]
1161-
#[must_use = "method returns a new number and does not mutate the original value"]
1162-
#[unstable(feature = "float_algebraic", issue = "21690")]
1163-
#[inline]
1164-
pub fn add_algebraic(self, rhs: f64) -> f64 {
1165-
intrinsics::fadd_algebraic(self, rhs)
1166-
}
1167-
1168-
/// Float subtraction that allows optimizations based on algebraic rules.
1169-
#[rustc_allow_incoherent_impl]
1170-
#[doc(alias = "fsub_algebraic", alias = "subAlgebraic")]
1171-
#[must_use = "method returns a new number and does not mutate the original value"]
1172-
#[unstable(feature = "float_algebraic", issue = "21690")]
1173-
#[inline]
1174-
pub fn sub_algebraic(self, rhs: f64) -> f64 {
1175-
intrinsics::fsub_algebraic(self, rhs)
1176-
}
1177-
1178-
/// Float multiplication that allows optimizations based on algebraic rules.
1179-
#[rustc_allow_incoherent_impl]
1180-
#[doc(alias = "fmul_algebraic", alias = "mulAlgebraic")]
1181-
#[must_use = "method returns a new number and does not mutate the original value"]
1182-
#[unstable(feature = "float_algebraic", issue = "21690")]
1183-
#[inline]
1184-
pub fn mul_algebraic(self, rhs: f64) -> f64 {
1185-
intrinsics::fmul_algebraic(self, rhs)
1186-
}
1187-
1188-
/// Float division that allows optimizations based on algebraic rules.
1189-
#[rustc_allow_incoherent_impl]
1190-
#[doc(alias = "fdiv_algebraic", alias = "divAlgebraic")]
1191-
#[must_use = "method returns a new number and does not mutate the original value"]
1192-
#[unstable(feature = "float_algebraic", issue = "21690")]
1193-
#[inline]
1194-
pub fn div_algebraic(self, rhs: f64) -> f64 {
1195-
intrinsics::fdiv_algebraic(self, rhs)
1196-
}
1197-
1198-
/// Float remainder that allows optimizations based on algebraic rules.
1199-
#[rustc_allow_incoherent_impl]
1200-
#[doc(alias = "frem_algebraic", alias = "remAlgebraic")]
1201-
#[must_use = "method returns a new number and does not mutate the original value"]
1202-
#[unstable(feature = "float_algebraic", issue = "21690")]
1203-
#[inline]
1204-
pub fn rem_algebraic(self, rhs: f64) -> f64 {
1205-
intrinsics::frem_algebraic(self, rhs)
1206-
}
12071157
}

0 commit comments

Comments
 (0)