Uh oh!
There was an error while loading. Please reload this page.
change c_double to f32 on avr targets - #154647
Conversation
rustbot
commented
Mar 31, 2026
|
There was a problem hiding this comment.
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.
tgross35
commented
Mar 31, 2026
@bors r+ rollup |
2e4c5ca to
de0c9f0Compare
This pull request was unapproved. |
| 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. |
There was a problem hiding this comment.
should we expclicitly mention avr here? https://doc.rust-lang.org/std/ffi/type.c_int.html does not name specific platforms.
There was a problem hiding this comment.
If anything maybe just say "on some 16-bit targets"? r=me either way
folkertdev
commented
Mar 31, 2026
After discussion in #t-compiler/help > what is `#[doc(cfg(all()))]` I changed this implementation to be more consistent. |
de0c9f0 to
fa91004Compare
This comment has been minimized.
This comment has been minimized.
fa91004 to
dc9836eComparefolkertdev
commented
Mar 31, 2026
@bors r=tgross35 rollup |
…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
Uh oh!
There was an error while loading. Please reload this page.
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
Extracted from #152980. That version also makes this change for
msp430but that is actually incorrect based on https://www.ti.com/lit/ug/slau132r/slau132r.pdf table 5-1 that specifiesdoubleasf64.r? tgross35
cc @Patryk27@workingjubilee