Skip to content

Rollup of 10 pull requests #138006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2c752bc
Undeprecate env::home_dir
arlosi Feb 20, 2025
b340545
[illumos] attempt to use posix_spawn to spawn processes
sunshowers Feb 11, 2025
78615ff
Stablize `string_extend_from_within`
aDotInTheVoid Feb 24, 2025
0ca1c9c
Count char width at most once in Formatter::pad
thaliaarchi Feb 6, 2025
4c45285
Add `dist:Gcc` build step
Kobzol Feb 26, 2025
e4bfad2
Build GCC on the Linux x64 dist runner
Kobzol Feb 28, 2025
6563437
Create the `OptimizedDist` tool with a macro
Kobzol Feb 21, 2025
96a9197
Allow specifying that tools build a library, not a binary
Kobzol Feb 21, 2025
807f6ff
Implement `RunMakeSupport` tool using the `bootstrap_tool!` macro
Kobzol Feb 21, 2025
4af94f8
Implement `RunMake` test suite using the `test!` macro
Kobzol Feb 21, 2025
86aae8e
uefi: Add Service Binding Protocol abstraction
Ayush1325 Feb 23, 2025
0034d6c
Compile run-make recipes using the stage0 compiler
Kobzol Feb 24, 2025
9d6ca5f
Ignore a-b-a-linker-guard during cross-compilation
Kobzol Feb 25, 2025
a0ed304
float: Update some constants to `pub(crate)`
tgross35 Dec 9, 2024
5a2da96
dec2flt: Update documentation of existing methods
tgross35 Dec 9, 2024
49a2d4c
dec2flt: Rename `Decimal` to `DecimalSeq`
tgross35 Dec 9, 2024
626d2c5
dec2flt: Rename `Number` to `Decimal`
tgross35 Dec 9, 2024
6c34daf
dec2flt: Rename fields to be consistent with documented notation
tgross35 Dec 9, 2024
19a909a
dec2flt: Refactor float traits
tgross35 Dec 9, 2024
37e223c
dec2flt: Refactor the fast path
tgross35 Dec 9, 2024
6324b39
promote ohos targets to tier to with host tools
LuuuXXX Feb 12, 2025
7279acf
use measureme-12.0.1
LuuuXXX Feb 15, 2025
6efacfb
add fix for full tools and sanitizer
LuuuXXX Feb 24, 2025
4dab55b
Revert "add fix for full tools and sanitizer"
LuuuXXX Mar 4, 2025
3eb04fd
add support for extend rust tools and sanitizer
LuuuXXX Mar 4, 2025
6463590
Postprocess test suite metrics into GitHub summary
Kobzol Feb 15, 2025
2e5ab4e
Store bootstrap command-line into metrics
Kobzol Feb 19, 2025
ead58ea
Move `BuildStep` and metric logging into `build_helper`
Kobzol Mar 4, 2025
7b53ac7
Record bootstrap step durations into GitHub summary in citool
Kobzol Mar 2, 2025
f331260
add note for miri
LuuuXXX Mar 4, 2025
0ea5a73
Rollup merge of #134063 - tgross35:dec2flt-refactoring, r=Noratrieb
jieyouxu Mar 4, 2025
588aa63
Rollup merge of #136662 - thaliaarchi:formatter-pad-char-count, r=m-o…
jieyouxu Mar 4, 2025
6930886
Rollup merge of #137011 - LuuuXXX:promote-ohos-with-host-tools, r=Ama…
jieyouxu Mar 4, 2025
5813a6e
Rollup merge of #137077 - Kobzol:citool-test-metrics, r=marcoieni
jieyouxu Mar 4, 2025
10faff4
Rollup merge of #137327 - arlosi:home-dir, r=Mark-Simulacrum
jieyouxu Mar 4, 2025
85ebc01
Rollup merge of #137373 - Kobzol:tool-stage0-improve, r=jieyouxu
jieyouxu Mar 4, 2025
b00b604
Rollup merge of #137463 - sunshowers:illumos-posix-spawn, r=Mark-Simu…
jieyouxu Mar 4, 2025
da862b1
Rollup merge of #137477 - Ayush1325:uefi-service-binding, r=Noratrieb
jieyouxu Mar 4, 2025
038edab
Rollup merge of #137569 - aDotInTheVoid:for-iurii, r=ibraheemdev
jieyouxu Mar 4, 2025
41b6c76
Rollup merge of #137667 - Kobzol:gcc-dist-build, r=onur-ozkan
jieyouxu Mar 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dec2flt: Rename fields to be consistent with documented notation
  • Loading branch information
tgross35 committed Mar 2, 2025
commit 6c34daff57101922dc97e1860bf5940ea88d3906
13 changes: 7 additions & 6 deletions library/core/src/num/dec2flt/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,20 @@ pub(crate) fn is_8digits(v: u64) -> bool {
(a | b) & 0x8080_8080_8080_8080 == 0
}

/// A custom 64-bit floating point type, representing `f * 2^e`.
/// e is biased, so it be directly shifted into the exponent bits.
/// A custom 64-bit floating point type, representing `m * 2^p`.
/// p is biased, so it be directly shifted into the exponent bits.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
pub struct BiasedFp {
/// The significant digits.
pub f: u64,
pub m: u64,
/// The biased, binary exponent.
pub e: i32,
pub p_biased: i32,
}

impl BiasedFp {
/// Represent `0 ^ p`
#[inline]
pub const fn zero_pow2(e: i32) -> Self {
Self { f: 0, e }
pub const fn zero_pow2(p_biased: i32) -> Self {
Self { m: 0, p_biased }
}
}
4 changes: 2 additions & 2 deletions library/core/src/num/dec2flt/lemire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn compute_float<F: RawFloat>(q: i64, mut w: u64) -> BiasedFp {
mantissa += mantissa & 1;
mantissa >>= 1;
power2 = (mantissa >= (1_u64 << F::MANTISSA_EXPLICIT_BITS)) as i32;
return BiasedFp { f: mantissa, e: power2 };
return BiasedFp { m: mantissa, p_biased: power2 };
}
// Need to handle rounding ties. Normally, we need to round up,
// but if we fall right in between and we have an even basis, we
Expand Down Expand Up @@ -111,7 +111,7 @@ pub fn compute_float<F: RawFloat>(q: i64, mut w: u64) -> BiasedFp {
// Exponent is above largest normal value, must be infinite.
return fp_inf;
}
BiasedFp { f: mantissa, e: power2 }
BiasedFp { m: mantissa, p_biased: power2 }
}

/// Calculate a base 2 exponent from a decimal exponent.
Expand Down
13 changes: 8 additions & 5 deletions library/core/src/num/dec2flt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ pub fn pfe_invalid() -> ParseFloatError {

/// Converts a `BiasedFp` to the closest machine float type.
fn biased_fp_to_float<T: RawFloat>(x: BiasedFp) -> T {
let mut word = x.f;
word |= (x.e as u64) << T::MANTISSA_EXPLICIT_BITS;
let mut word = x.m;
word |= (x.p_biased as u64) << T::MANTISSA_EXPLICIT_BITS;
T::from_u64_bits(word)
}

Expand Down Expand Up @@ -272,12 +272,15 @@ pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
// redundantly using the Eisel-Lemire algorithm if it was unable to
// correctly round on the first pass.
let mut fp = compute_float::<F>(num.exponent, num.mantissa);
if num.many_digits && fp.e >= 0 && fp != compute_float::<F>(num.exponent, num.mantissa + 1) {
fp.e = -1;
if num.many_digits
&& fp.p_biased >= 0
&& fp != compute_float::<F>(num.exponent, num.mantissa + 1)
{
fp.p_biased = -1;
}
// Unable to correctly round the float using the Eisel-Lemire algorithm.
// Fallback to a slower, but always correct algorithm.
if fp.e < 0 {
if fp.p_biased < 0 {
fp = parse_long_mantissa::<F>(s);
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/num/dec2flt/slow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ pub(crate) fn parse_long_mantissa<F: RawFloat>(s: &[u8]) -> BiasedFp {
}
// Zero out all the bits above the explicit mantissa bits.
mantissa &= (1_u64 << F::MANTISSA_EXPLICIT_BITS) - 1;
BiasedFp { f: mantissa, e: power2 }
BiasedFp { m: mantissa, p_biased: power2 }
}
8 changes: 4 additions & 4 deletions library/coretests/tests/num/dec2flt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ fn test_f32_integer_decode() {

// Ignore the "sign" (quiet / signalling flag) of NAN.
// It can vary between runtime operations and LLVM folding.
let (nan_m, nan_e, _nan_s) = f32::NAN.integer_decode();
assert_eq!((nan_m, nan_e), (12582912, 105));
let (nan_m, nan_p, _nan_s) = f32::NAN.integer_decode();
assert_eq!((nan_m, nan_p), (12582912, 105));
}

#[test]
Expand All @@ -28,6 +28,6 @@ fn test_f64_integer_decode() {

// Ignore the "sign" (quiet / signalling flag) of NAN.
// It can vary between runtime operations and LLVM folding.
let (nan_m, nan_e, _nan_s) = f64::NAN.integer_decode();
assert_eq!((nan_m, nan_e), (6755399441055744, 972));
let (nan_m, nan_p, _nan_s) = f64::NAN.integer_decode();
assert_eq!((nan_m, nan_p), (6755399441055744, 972));
}
4 changes: 2 additions & 2 deletions library/coretests/tests/num/dec2flt/lemire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use core::num::dec2flt::lemire::compute_float;

fn compute_float32(q: i64, w: u64) -> (i32, u64) {
let fp = compute_float::<f32>(q, w);
(fp.e, fp.f)
(fp.p_biased, fp.m)
}

fn compute_float64(q: i64, w: u64) -> (i32, u64) {
let fp = compute_float::<f64>(q, w);
(fp.e, fp.f)
(fp.p_biased, fp.m)
}

#[test]
Expand Down