') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Deduplicated float tests and unified in floats/mod.rs by xonx4l · Pull Request #148206 · rust-lang/rust · GitHub
Skip to content

Deduplicated float tests and unified in floats/mod.rs - #148206

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
xonx4l:deduplicate-float-tests
Feb 16, 2026
Merged

Deduplicated float tests and unified in floats/mod.rs#148206
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
xonx4l:deduplicate-float-tests

Conversation

@xonx4l

@xonx4lxonx4l commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

In this PR Float tests are deduplicated and are unified in floats/mod.rs, as discussed in #141726.

The moved float tests are:

-> test_powf
-> test_exp
-> test_exp2
-> test_ln
-> test_log_generic
-> test_log2
-> test_log10
-> test_asinh
-> test_acosh
-> test_atanh
-> test_gamma
-> test_ln_gamma

Closes: #141726

r? tgross35

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 28, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

tgross35 is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

Comment threadlibrary/std/tests/floats/lib.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@xonx4l
xonx4l requested a review from bjorn3November 4, 2025 00:43
@xonx4l

Copy link
Copy Markdown
ContributorAuthor

Any update @bjorn3 ?

@bjorn3

Copy link
Copy Markdown
Member

CI is still failing.

@xonx4l

Copy link
Copy Markdown
ContributorAuthor

CI is still failing.

ok let me fix .

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@xonx4l
xonx4lforce-pushed the deduplicate-float-tests branch from b802b19 to abd73fdCompareNovember 14, 2025 08:43
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

let inf: Float = Float::INFINITY;
let neg_inf: Float = Float::NEG_INFINITY;
assert_biteq!((10.0 as Float).log(10.0), 1.0);
assert_approx_eq!((2.3 as Float).log(3.5), 0.664858, Float::LOG_APPROX);

@LorrensP-2158466LorrensP-2158466Nov 17, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test here for f128 will fail because the precision is much higher, if you look at the original test, the expected value is much more precise than what you have written:

assert_approx_eq!(2.3f128.log(3.5),0.66485771361478710036766645911922010272,TOL);

When testing higher precision floats, you need much more precise expected values or the tests will fail, as they do now. In Miri, this is even more strict.

If you look at the source of f16 constants, they use much more digits after the decimal point than needed:

pubconstPI:f16 = 3.14159265358979323846264338327950288_f16;

So you should probably do that as well.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay it makes sense . Thanks

@tgross35

Copy link
Copy Markdown
Member

Thank you for the final cleanup here. Until CI is fixed,
@rustbot author

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@xonx4l

Copy link
Copy Markdown
ContributorAuthor

Thank you for the final cleanup here. Until CI is fixed, @rustbot author

Will finish this as soon as possible . A bit busy these days.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@xonx4l
xonx4lforce-pushed the deduplicate-float-tests branch from 0f27f23 to 507fb72CompareDecember 23, 2025 17:59
rust-borsBot pushed a commit that referenced this pull request Jan 31, 2026
Deduplicated float tests and unified in floats/mod.rs
try-job: aarch64-apple
try-job: x86_64-mingw-1
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-borsBot commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 7250dcf failed: CI. Failed job:

@xonx4l

Copy link
Copy Markdown
ContributorAuthor

@tgross35 what you suggest for these macOS linker errors?

@tgross35

Copy link
Copy Markdown
Member

Sorry, I've been a bit busy. It looks like 451738f got wiped away, could you cherry pick it back? Those look like the right kind of failures.

(maybe you know already but in case you don't - if you add .patch to a github commit page then it gives you the plaintext patch, so you can run curl https://github.com/rust-lang/rust/commit/451738f6b0bc30d9a77be5ae304bbc5cdd71caa2.patch | git am to easily pick a commit)

@xonx4l

Copy link
Copy Markdown
ContributorAuthor

Yeah not a problem I myself was busy and I will cherry-pick that commit asap.

@rust-log-analyzer

This comment has been minimized.

@tgross35

Copy link
Copy Markdown
Member

You'll need to add the #![feature] to the coretests as suggested above, that's a new associated constant.

@tgross35

Copy link
Copy Markdown
Member

@bors try jobs=aarch64-apple,x86_64-mingw-1

@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-borsBot commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 014baa1 failed: CI. Failed job:

@rust-bors

This comment has been minimized.

@rustbot

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

xonx4land others added 2 commits February 15, 2026 18:00
New float tests in core are failing on clif with issues like the
following:
Undefined symbols for architecture arm64:
"_coshf128", referenced from:
__RNvMNtCshY0fR2o0hOA_3std4f128C4f1284coshCs5TKtJxXQNGL_9coretests in coretests-e38519c0cc90db54.coretests.44b6247a565e10d1-cgu.10.rcgu.o
"_exp2f128", referenced from:
__RNvMNtCshY0fR2o0hOA_3std4f128C4f1284exp2Cs5TKtJxXQNGL_9coretests in coretests-e38519c0cc90db54.coretests.44b6247a565e10d1-cgu.10.rcgu.o
...
Disable f128 math unless the symbols are known to be available, which
for now is only glibc targets. This matches the LLVM backend.
@xonx4l

Copy link
Copy Markdown
ContributorAuthor

@tgross35 If everything looks good you can rerun bors . I hope it passes this time .

@tgross35

Copy link
Copy Markdown
Member

@bors try jobs=aarch64-apple,x86_64-mingw-1

@rust-bors

This comment has been minimized.

@rust-bors

rust-borsBot commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b9d8d0c (b9d8d0ce4b09c9ce57f304ee5fe47a428ccd875e, parent: 139651428df86cf88443295542c12ea617cbb587)

@tgross35tgross35 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try again! Thanks for the updates.
@bors r+ rollup=iffy

View changes since this review

@rust-bors

rust-borsBot commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 8379475 has been approved by tgross35

It is now in the queue for this repository.

@jhprattjhpratt mentioned this pull request Feb 16, 2026
@xonx4l

Copy link
Copy Markdown
ContributorAuthor

I really wanted to thanks @tgross35 for holding on this for so long and showing me direction whenever needed and also @bjorn3 for his help. (P.s. I am sure that I am not forgetting how to patch and rebase ever in this lifetime thanks to this Pr)

@tgross35

Copy link
Copy Markdown
Member

We’re always happy to help, and we appreciate the effort :)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant to the library team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify and deduplicate float tests

8 participants

@xonx4l@rustbot@rust-log-analyzer@bjorn3@tgross35@JonathanBrouwer@GuillaumeGomez@LorrensP-2158466