Skip to content

Commit f5dc702

Browse files
committed
Check the existence of is_subnormal (1.53) before forwarding
1 parent 19cb6f0 commit f5dc702

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
1.38.0, # has_div_euclid
2020
1.44.0, # has_to_int_unchecked
2121
1.46.0, # has_leading_trailing_ones
22+
1.53.0, # has_is_subnormal
2223
stable,
2324
beta,
2425
nightly,

bors.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ status = [
55
"Test (1.38.0)",
66
"Test (1.44.0)",
77
"Test (1.46.0)",
8+
"Test (1.53.0)",
89
"Test (stable)",
910
"Test (beta)",
1011
"Test (nightly)",

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn main() {
1515
if env::var_os("CARGO_FEATURE_STD").is_some() {
1616
ac.emit_expression_cfg("1f64.copysign(-1f64)", "has_copysign");
1717
}
18+
ac.emit_expression_cfg("1f64.is_subnormal()", "has_is_subnormal");
1819

1920
autocfg::rerun_path("build.rs");
2021
}

ci/rustup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
set -ex
66

77
ci=$(dirname $0)
8-
for version in 1.31.0 1.35.0 1.37.0 1.38.0 1.44.0 1.46.0 stable beta nightly; do
8+
for version in 1.31.0 1.35.0 1.37.0 1.38.0 1.44.0 1.46.0 1.53.0 stable beta nightly; do
99
rustup run "$version" "$ci/test_full.sh"
1010
done

src/float.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,6 @@ impl FloatCore for f64 {
923923
Self::is_infinite(self) -> bool;
924924
Self::is_finite(self) -> bool;
925925
Self::is_normal(self) -> bool;
926-
Self::is_subnormal(self) -> bool;
927926
Self::classify(self) -> FpCategory;
928927
Self::floor(self) -> Self;
929928
Self::ceil(self) -> Self;
@@ -942,6 +941,11 @@ impl FloatCore for f64 {
942941
Self::to_radians(self) -> Self;
943942
}
944943

944+
#[cfg(has_is_subnormal)]
945+
forward! {
946+
Self::is_subnormal(self) -> bool;
947+
}
948+
945949
#[cfg(all(not(feature = "std"), feature = "libm"))]
946950
forward! {
947951
libm::floor as floor(self) -> Self;
@@ -1960,7 +1964,6 @@ macro_rules! float_impl_std {
19601964
Self::is_infinite(self) -> bool;
19611965
Self::is_finite(self) -> bool;
19621966
Self::is_normal(self) -> bool;
1963-
Self::is_subnormal(self) -> bool;
19641967
Self::classify(self) -> FpCategory;
19651968
Self::floor(self) -> Self;
19661969
Self::ceil(self) -> Self;
@@ -2007,9 +2010,13 @@ macro_rules! float_impl_std {
20072010
}
20082011

20092012
#[cfg(has_copysign)]
2010-
#[inline]
2011-
fn copysign(self, sign: Self) -> Self {
2012-
Self::copysign(self, sign)
2013+
forward! {
2014+
Self::copysign(self, sign: Self) -> Self;
2015+
}
2016+
2017+
#[cfg(has_is_subnormal)]
2018+
forward! {
2019+
Self::is_subnormal(self) -> bool;
20132020
}
20142021
}
20152022
};

0 commit comments

Comments
 (0)