Skip to content

Commit c3c7fab

Browse files
committed
Expose algebraic floating point intrinsics.
1 parent 4a43094 commit c3c7fab

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

library/std/src/f32.rs

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

library/std/src/f64.rs

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

0 commit comments

Comments
 (0)