-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Printing of the largest and other very large floats is wrong #7030
Comments
Related to #6220. |
All the large floating-point numbers are multiple of 2^971, so the expected result should not be so odd (pun intended). The largest floating-point number is actually:
|
triage bump. i think one of these bugs should be production ready. nominating this one. |
Accepted for production-ready |
With a heavy heart, not tagging as 1.0 blocker. P-high, not 1.0. |
@pnkfelix why is this not a 1.0 blocker? |
@tshepang because at the time of that triage, we decided it would be acceptable to fix this after 1.0 As in, we were not saying we cannot fix it; just that we would not wait for perfection before releasing 1.0 I do hope the recently posted flt2dec PR gets into 1.0 |
@pnkfelix what I wanted to know is why this was decided. For example, is the fix hard and/or time consuming? |
Yes, fixing this properly is hard. See PR #24612 for a taste of the difficulty |
@pnkfelix thanks |
This is a direct port of my prior work on the float formatting. The detailed description is available [here](https://github.com/lifthrasiir/rust-strconv#flt2dec). In brief, * This adds a new hidden module `core::num::flt2dec` for testing from `libcoretest`. Why is it in `core::num` instead of `core::fmt`? Because I envision that the table used by `flt2dec` is directly applicable to `dec2flt` (cf. #24557) as well, which exceeds the realm of "formatting". * This contains both Dragon4 algorithm (exact, complete but slow) and Grisu3 algorithm (exact, fast but incomplete). * The code is accompanied with a large amount of self-tests and some exhaustive tests. In particular, `libcoretest` gets a new dependency on `librand`. For the external interface it relies on the existing test suite. * It is known that, in the best case, the entire formatting code has about 30 KBs of binary overhead (judged from strconv experiments). Not too bad but there might be a potential room for improvements. This is rather large code. I did my best to comment and annotate the code, but you have been warned. For the maximal availability the original code was licensed in CC0, but I've also dual-licensed it in MIT/Apache as well so there should be no licensing concern. This is [breaking-change] as it changes the float output slightly (and it also affects the casing of `inf` and `nan`). I hope this is not a big deal though :) Fixes #7030, #18038 and #24556. Also related to #6220 and #20870. ## Known Issues - [x] I've yet to finish `make check-stage1`. It does pass main test suites including `run-pass` but there might be some unknown edges on the doctests. - [ ] Figure out how this PR affects rustc. - [ ] Determine which internal routine is mapped to the formatting specifier. Depending on the decision, some internal routine can be safely removed (for instance, currently `to_shortest_str` is unused).
Clippy going dark: Adding a dark theme to Clippy's lint list This PR adds the MdBook color themes to the lint list of Clippy. Well at least an adaption of these themes. <details> <summary>Here are some beautiful screenshots:</summary> **light theme**  **Rust theme**  **Coal theme**  **Navy theme**  **Ayu theme**  </details> The theme is also stored in the browser to ensure that the next session applies the theme and doesn't burn your eyes out. cc: `@matthiaskrgr` --- Closes rust-lang#6877 changelog: [Clippy's lint list](https://rust-lang.github.io/rust-clippy/master/index.html) now supports themes
…es, r=llogiq Quick fix for the updated website theaming to access the correct css files This fixes a problem from rust-lang#7030 that the service used to access css files was blocked by GitHub pages due to `SSL_ERROR_BAD_CERT_DOMAIN`. The css file loading worked fine during local development. The browser probably disabled some security options due to the local address. This fix works locally and should also work online as it references the direct css files used by the [mdBook User Guide](https://rust-lang.github.io/mdBook/index.html) the disadvantage of this is that refactorings within the mdBook project can have effects on the theme loading of Clippy. This PR is therefor more meant as a quick fix until I find a better solution. I've tested these changes using the page editor in the browser and can now confirm that they work :) changelog: none r? `@llogiq`
If you run std::float::infinity.next_after(1.0)` you get the following (unexpected result)
the expected result is actually something like
The text was updated successfully, but these errors were encountered: