Skip to content

Remove float from the language #7525

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
emberian opened this issue Jul 1, 2013 · 3 comments
Closed

Remove float from the language #7525

emberian opened this issue Jul 1, 2013 · 3 comments
Labels
A-grammar Area: The grammar of Rust

Comments

@emberian
Copy link
Member

emberian commented Jul 1, 2013

I propose to remove the float type from the language.

float is defined by the manual as "the largest floating-point type that is directly supported by hardware on the target machine," but this isn't actually true (x87 supports 80-bit floats). I've seen it advertised as the "fastest float for the target," but performance also needs to include cache and bus pressure as well, not just speed of manipulation, and often the "fasted" in terms of manipulation is going to be some SIMD type using a coprocessor, and the situation gets even trickier if/when we have Rust being used for GPGPU kernels (LLVM has an R600 (AMD GPU) backend) or accelerator chips (a la Epiphany (parallella)). Furthermore it can cause confusion for incoming C/C++ programmers who would expect float to be an f32.

Variable width floating point code is also dangerous - frequently code has implicit assumptions about accuracy. Using floating point correctly is already hard enough, introducing variable width types makes it even harder.

I would remove float entirely, instead using f32 and f64 exclusively, also removing the f suffix for float literals. This allows user code to typedef float to what they want.

@brson
Copy link
Contributor

brson commented Jul 10, 2013

nominating

@emberian
Copy link
Member Author

@emberian
Copy link
Member Author

dup of #6592

flip1995 pushed a commit to flip1995/rust that referenced this issue Aug 12, 2021
…, r=flip1995

Updated `define_Conf!` to support multi-line doc comments

Updated the `define_Conf!` macro to support multi-line doc comments for readability. This also enables configuration documentation to have multiple paragraphs.

I've also added the `metadata-collector-lint` feature to the CI build and testing tasks. (I would think that we want this, now that we officially switched over)

---

Now a small informal explanation what this PR changes (just for fun):

* *Once upon a time there was a monster. It was handsome, supportive and happy to dig through the best source code it has ever seen. Spanning over hundreds of lines and reading over complete crates, it was purely marvels!*

    *However, there was one region in its territory that wasn't clean and well formatted like the rest. That was the mighty `define_Conf` macro. The monster would have cleaned it up a long time ago but, the previous ruler of this kingdom a powerful Python script was prohibiting it. But now that the old king was slain in the great battle of rust-1.54.0, everything was possible again. Our lovely monster was now able to grab its cleaning equipment and get some nice formatting into the now unprotected area.*

    *Said and done! Let this day go down in history!*

(I'll be the first to admit, that I'm a bit lost today. And I'm also procrastinating on some other discussions where I have some catching up to do... Oh, well, this was fun)

---

changelog: none

r? `@flip1995`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: The grammar of Rust
Projects
None yet
Development

No branches or pull requests

2 participants