Skip to content

change c_double to f32 on avr targets - #154647

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
folkertdev:avr-c_double-f32
Apr 1, 2026
Merged

change c_double to f32 on avr targets#154647
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
folkertdev:avr-c_double-f32

Conversation

@folkertdev

Copy link
Copy Markdown
Contributor

Extracted from #152980. That version also makes this change for msp430 but that is actually incorrect based on https://www.ti.com/lit/ug/slau132r/slau132r.pdf table 5-1 that specifies double as f64.

r? tgross35
cc @Patryk27@workingjubilee

@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 Mar 31, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

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

@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.

This has been on my todo list for a while, thanks!

Note that there are some LLVM bugs related to this. IIRC LLVM's double type (always double precision) will emit calls like sqrt which are of course single precision when it needs to use sqrtf64. Not that many people are running complicated float math on AVR, and that doesn't affect this change in any case.

View changes since this review

@tgross35

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2e4c5ca has been approved by tgross35

It is now in the queue for this repository.

@rust-borsrust-borsBot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 31, 2026
@rust-borsrust-borsBot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 31, 2026
@rust-bors

rust-borsBot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

⚠️ A new commit de0c9f0df6f0af2600e6fca1b62976dac38ec360 was pushed.

This pull request was unapproved.

Comment threadlibrary/core/src/ffi/c_double.md Outdated
Equivalent to C's `double` type.

This type will almost always be [`f64`], which is guaranteed to be an [IEEE 754 double-precision float] in Rust. That said, the standard technically only guarantees that it be a floating-point number with at least the precision of a [`float`], and it may be `f32` or something entirely different from the IEEE-754 standard.
This type will almost always be [`f64`], which is guaranteed to be an [IEEE 754 double-precision float] in Rust. That said, the standard technically only guarantees that it be a floating-point number with at least the precision of a [`float`], and it may be [`f32`] or something entirely different from the IEEE-754 standard.

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.

should we expclicitly mention avr here? https://doc.rust-lang.org/std/ffi/type.c_int.html does not name specific platforms.

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.

If anything maybe just say "on some 16-bit targets"? r=me either way

@folkertdev

Copy link
Copy Markdown
ContributorAuthor

After discussion in #t-compiler/help > what is `#[doc(cfg(all()))]` I changed this implementation to be more consistent.

@rust-log-analyzer

This comment has been minimized.

@folkertdev

Copy link
Copy Markdown
ContributorAuthor

@bors r=tgross35 rollup

@rust-bors

rust-borsBot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

📌 Commit dc9836e has been approved by tgross35

It is now in the queue for this repository.

@rust-borsrust-borsBot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 31, 2026
@jhprattjhpratt mentioned this pull request Apr 1, 2026
rust-borsBot pushed a commit that referenced this pull request Apr 1, 2026
Rollup of 4 pull requests
Successful merges:
- #154356 ( Add integer truncation and extension methods)
- #154641 (build_helper: fix yarn locking, add check, and bump lockfile)
- #154647 (change `c_double` to `f32` on `avr` targets)
- #154655 (Fix associated type bound suggestion span issue)
chenyukang added a commit to chenyukang/rust that referenced this pull request Apr 1, 2026
…oss35
change `c_double` to `f32` on `avr` targets
Extracted from rust-lang#152980. That version also makes this change for `msp430` but that is actually incorrect based on https://www.ti.com/lit/ug/slau132r/slau132r.pdf table 5-1 that specifies `double` as `f64`.
r? tgross35
cc @Patryk27@workingjubilee
@chenyukangchenyukang mentioned this pull request Apr 1, 2026
@rust-bors
rust-borsBot merged commit 1fb655c into rust-lang:mainApr 1, 2026
11 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Apr 1, 2026
rust-timer added a commit that referenced this pull request Apr 1, 2026
Rollup merge of #154647 - folkertdev:avr-c_double-f32, r=tgross35
change `c_double` to `f32` on `avr` targets
Extracted from #152980. That version also makes this change for `msp430` but that is actually incorrect based on https://www.ti.com/lit/ug/slau132r/slau132r.pdf table 5-1 that specifies `double` as `f64`.
r? tgross35
cc @Patryk27@workingjubilee
@Mark-SimulacrumMark-Simulacrum added the relnotes Marks issues that should be documented in the release notes of the next release. label May 11, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotesMarks issues that should be documented in the release notes of the next release.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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@folkertdev@rustbot@tgross35@rust-log-analyzer@Mark-Simulacrum